Ben Laskowski
/
Larsen
A simple Larsen scanner using the onboard LEDs.... because there aren't enough of these already.
Diff: main.cpp
- Revision:
- 0:1caccdf9730e
diff -r 000000000000 -r 1caccdf9730e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 27 18:47:50 2010 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +BusOut ledarray(LED1, LED2, LED3, LED4); + +int main(void) { + //A flag to indicate which direction we should rotate + bool flag = 0; + //the states of the outputs + char outstates = 1; + + //Place the outputs in a known state + ledarray=1; + + //Infinite loop + while(1) { + wait(0.25); + if (!flag) { + outstates *= 2; + if ((outstates>>3)&&1) flag=1; + } else { + outstates /=2; + if (outstates==1) flag=0; + } + ledarray=outstates; + } +} + + \ No newline at end of file