this is a ping-pang blinky in 4 LED.
Fork of mbed-os-example-mbed5-blinky by
main.cpp
- Committer:
- jasonjee
- Date:
- 2016-10-20
- Revision:
- 14:c4162b826d08
- Parent:
- 8:bb09890333fe
File content as of revision 14:c4162b826d08:
#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 = !(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); } }