Rikiya Yamamoto
/
mbed_blinky_LPC1114
mbed_blinky_LPC1114
Fork of mbed_blinky by
Revision 7:f43f82ebd32a, committed 2015-03-23
- Comitter:
- rkyymmt
- Date:
- Mon Mar 23 03:31:08 2015 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- init
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 e8cd76f38fa9 -r f43f82ebd32a main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Mon Mar 23 03:31:08 2015 +0000 @@ -1,12 +1,24 @@ #include "mbed.h" -DigitalOut myled(LED1); +DigitalOut leds[] = {dp1, dp2, dp4, dp6, dp9, dp10, dp11, dp13, dp14}; +int numLeds = sizeof(leds)/sizeof(DigitalOut); int main() { + double w_time = 0.05; while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + for (int previous, i = 0; i < numLeds; i++){ + if (i == 0) previous = (numLeds - 1); + else previous = i - 1; + leds[i] = 1; + leds[previous] = 0; + wait(w_time); + } + for (int previous, i = numLeds - 1; i > 0; i--){ + if (i == 0) previous = (numLeds - 1); + else previous = i + 1; + leds[i] = 1; + leds[previous] = 0; + wait(w_time); + } } }
diff -r e8cd76f38fa9 -r f43f82ebd32a mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Mon Mar 23 03:31:08 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file