Sim mbed
/
MyFirstSample
Revision 0:0fe24cc38a8c, committed 2009-11-26
- Comitter:
- Sim
- Date:
- Thu Nov 26 13:35:22 2009 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 0fe24cc38a8c main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 26 13:35:22 2009 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +void ledout(int pat) { + led1 = pat & 1; + led2 = pat >> 1 & 1; + led3 = pat >> 2 & 1; + led4 = pat >> 3 & 1; +} + +int main() { + int i; + + while (1) { + // move left + for (i = 0x01; i != 0x8; i <<= 1) { + ledout(i); + wait(0.2); + } + // move right + for (i = 0x08; i != 1; i >>= 1) { + ledout(i); + wait(0.2); + } + } +}
diff -r 000000000000 -r 0fe24cc38a8c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 26 13:35:22 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4