This is my first project using the mBed to an extent. The software is a basic traffic light with a blinking LED to show it is running and a warning LED before it changes.
Diff: main.cpp
- Revision:
- 0:810b0d9d1ff3
diff -r 000000000000 -r 810b0d9d1ff3 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 14 18:32:36 2011 +0000 @@ -0,0 +1,51 @@ +#include "mbed.h" + +DigitalOut boardLed(LED1); +DigitalOut getReady(LED2); + +DigitalOut redOne(p5); +DigitalOut greenOne(p6); + +DigitalOut redTwo(p9); +DigitalOut greenTwo(p10); + +//a traffic light + +int main() { + + while(1) { + boardLed = 1; + + redOne = 1; + redTwo = 0; + greenOne = 0; + greenTwo = 1; + getReady = 0; + + wait(5); + boardLed = 0; + wait(5); + boardLed = 1; + wait(5); + boardLed = 0; + getReady = 1; + wait(5); + + boardLed = 1; + + redOne = 0; + redTwo = 1; + greenOne = 1; + greenTwo = 0; + getReady = 0; + + wait(5); + boardLed = 0; + wait(5); + boardLed = 1; + wait(5); + boardLed = 0; + getReady = 1; + wait(5); + } +}