![](/media/cache/profiles/647c722bf90a49140184672e0d3723e3.50x50_q85.jpg)
Directional Indicator for a motor vehicle.
Diff: main.cpp
- Revision:
- 0:f737398ea333
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 07 20:45:46 2014 +0000 @@ -0,0 +1,29 @@ +/************************************************************************************ +Scrolling Car Indicator +************************************************************************************* +xnor 2014/02/07 +************************************************************************************/ +#include "mbed.h" + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + +int main() +{ + DigitalOut leds[4] = {myled1, myled2, myled3, myled4}; + int pattern[6][4] = {{1,1,1,1},{1,1,1,1},{0,1,1,1},{0,0,1,1},{0,0,0,1},{0,0,0,0}}; + int i=0; + while(1) + { + leds[0] = pattern[i][0]; + leds[1] = pattern[i][1]; + leds[2] = pattern[i][2]; + leds[3] = pattern[i][3]; + wait(0.125); + i++; + i == 6? i=0:0; + } +} +