m a
/
01_blinky1
This program uses the 4 LEDS of the mbed to produce the famous Knight Rider pattern (displayed on Kit).
Diff: main.cpp
- Revision:
- 0:07e6f78069f6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 05 11:41:32 2010 +0000 @@ -0,0 +1,20 @@ +// Knight Riger Pattern Generator - by Boseji +// http://m8051.blogspot.com +#include "mbed.h" +#define WAIT_time 0.04 +#define D() wait(WAIT_time) +DigitalOut mled0(LED1); +DigitalOut mled1(LED2); +DigitalOut mled2(LED3); +DigitalOut mled3(LED4); +int main() { + while(1) { + mled0 = 1;D();mled1 = 1;D();mled2 = 1;D(); + mled3 = 1;mled0=0;D(); + mled1 = 0;D();mled2 = 0;D();mled3 = 0;D();D();D(); + + mled3 = 1;D();mled2 = 1;D();mled1 = 1;D(); + mled0 = 1;mled3=0;D(); + mled2 = 0;D();mled1 = 0;D();mled0 = 0;D();D();D(); + } +}