Christopher Wardlaw
/
ME21001_Lab02_Exercise_04
exercise 4
Diff: main.cpp
- Revision:
- 0:82e77230d7bb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 24 14:57:19 2016 +0000 @@ -0,0 +1,27 @@ +/************************************************************** +/ Simple program program to show basic program structure +/ +/ The program flashes attached LEDs for 1 second sequentially and repeats indeffinitely. +/ +/**************************************************************/ + +#include "mbed.h" + +DigitalOut yelLED(p22); // name attached LED p22 +DigitalOut greLED(p23); // name attached LED p23 +DigitalOut redLED(p24); // name attached LED p24 +int main() { + while(1) { // repeat indefinitely + yelLED = 1; // activates yellow LED + wait(1); // pauses for a second + yelLED = 0; // deactivates yellow LED + wait(1); // pauses for a second + greLED = 1; // activates green LED + wait(1); // pauses for a second + greLED = 0; // deactivates green LED + wait(1); // pauses for a second + redLED = 1; // activates red LED + wait(1); // pauses for a second + redLED = 0; // deactivates red LED + } +} \ No newline at end of file