this is a ping-pang blinky in 4 LED.
Fork of mbed-os-example-mbed5-blinky by
Revision 14:c4162b826d08, committed 2016-10-20
- Comitter:
- jasonjee
- Date:
- Thu Oct 20 14:08:21 2016 +0000
- Parent:
- 13:191efdabc48f
- Commit message:
- this is a ping-pang blinky.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 05 05:15:02 2016 +0100 +++ b/main.cpp Thu Oct 20 14:08:21 2016 +0000 @@ -1,12 +1,23 @@ #include "mbed.h" DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); // main() runs in its own thread in the OS // (note the calls to Thread::wait below for delays) int main() { + char a=1,b; while (true) { - led1 = !led1; + led1 = !(a^1); + led2 = !(a^2); + led3 = !(a^4); + led4 = !(a^8); + if (led1) b=1; + if (led4) b=0; + if (b) a=a<<1; + else a=a>>1; Thread::wait(500); } }