exercise 4

Dependencies:   mbed

main.cpp

Committer:
cwardlaw
Date:
2016-09-24
Revision:
0:82e77230d7bb

File content as of revision 0:82e77230d7bb:

/**************************************************************
/ 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
  }
}