Christopher Wardlaw
/
ME21001_Lab02_Exercise_02
exercise 2
main.cpp
- Committer:
- cwardlaw
- Date:
- 2016-09-24
- Revision:
- 0:2ad7e17b2462
File content as of revision 0:2ad7e17b2462:
/************************************************************** / Simple program program to show basic program structure / / The program flashes onboard LED #1 on/off at a rate of 0.5Hz five times then waits five seconds and repeats. / /**************************************************************/ #include "mbed.h" DigitalOut myled(LED1); // use onboard LED #1 int main() { while(1) { // repeat indefinitely myled = 1; // turn on LED #1 wait(1.0); // wait 1s myled = 0; // turn off LED #1 wait(1); // wait 1s myled = 1; // turn on LED #1 wait(1.0); // wait 1s myled = 0; // turn off LED #1 wait(1); // wait 1s myled = 1; // turn on LED #1 wait(1.0); // wait 1s myled = 0; // turn off LED #1 wait(1); // wait 1s myled = 1; // turn on LED #1 wait(1.0); // wait 1s myled = 0; // turn off LED #1 wait(1); // wait 1s myled = 1; // turn on LED #1 wait(1.0); // wait 1s myled = 0; // turn off LED #1 wait(5); // wait 5s } }