jollen chen
/
mbed_led_run
advanced "hello, world"
Diff: main.cpp
- Revision:
- 0:c32ee89676db
diff -r 000000000000 -r c32ee89676db main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jan 20 06:50:10 2015 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + +unsigned int mask = 0x1; + +int main() { + wait(0.8); + + while(1) { + myled1 = mask & 0x1; + myled2 = mask & 0x2; + myled3 = mask & 0x4; + myled4 = mask & 0x8; + + wait(0.2); + + mask = mask << 1; + + if (mask & 0x10) + mask = 0x1; + } +}