Andrew Harpin
/
LED_Flash
Revision 0:1a0d62dc8f06, committed 2009-11-20
- Comitter:
- annodomini2
- Date:
- Fri Nov 20 20:00:05 2009 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 1a0d62dc8f06 defines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defines.h Fri Nov 20 20:00:05 2009 +0000 @@ -0,0 +1,8 @@ +#ifndef _DEFINES_H_ +#define _DEFINES_H_ + +#define ON 1 +#define OFF 0 + + +#endif \ No newline at end of file
diff -r 000000000000 -r 1a0d62dc8f06 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 20 20:00:05 2009 +0000 @@ -0,0 +1,80 @@ +#include "mbed.h" +#include "defines.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +int Led_State = 0; +int counter = 0; +bool reverse = false; + +int main() +{ + while (1) + { + switch(Led_State) + { + case 1: + led1 = ON; + wait(0.2); + led1 = OFF; + Led_State = 2; + break; + + case 2: + led2 = ON; + wait(0.2); + led2 = OFF; + Led_State = 3; + break; + + case 3: + led3 = ON; + wait(0.2); + led3 = OFF; + Led_State = 4; + break; + + case 4: + led4 = ON; + wait(0.2); + led4 = OFF; + + counter++; + + if(counter > 10) + { + Led_State = 0; + counter = 0; + } + else + { + Led_State = 1; + } + break; + + default: + led1 = ON; + led2 = ON; + led3 = ON; + led4 = ON; + wait(0.5); + led1 = OFF; + led2 = OFF; + led3 = OFF; + led4 = OFF; + wait(0.5); + + counter++; + + if(counter > 10) + { + Led_State = 1; + counter = 0; + } + break; + } + } +}
diff -r 000000000000 -r 1a0d62dc8f06 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 20 20:00:05 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4