KnightRider
Dependencies: mbed
Fork of HelloWorld by
Revision 2:1dccd91000a1, committed 2015-12-03
- Comitter:
- RudiNiki
- Date:
- Thu Dec 03 17:52:20 2015 +0000
- Parent:
- 1:03c191369089
- Commit message:
- tin rudi
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 03c191369089 -r 1dccd91000a1 main.cpp --- a/main.cpp Sun Jan 01 20:57:57 2012 +0000 +++ b/main.cpp Thu Dec 03 17:52:20 2015 +0000 @@ -1,12 +1,35 @@ #include "mbed.h" -DigitalOut myled(LED1); +BusOut myled(LED1, LED2, LED3, LED4); +DigitalIn JoyUp(p15); + int main() { while(1) { myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } + wait(0.05); + + for(int i=0; i < 3; i++) + { + myled = myled << 1; + wait(0.2); + } + + myled = 8; + wait(0.05); + for (int i=0; i < 3; i++) + { + myled = myled >> 1; + wait(0.2); + } + + if (JoyUp == 1) + { + myled = 15; + wait(0.5); + } + + } + + }