Christopher Wardlaw
/
ME21001_Lab02_Exercise_03
exercise 3
main.cpp
- Committer:
- cwardlaw
- Date:
- 2016-09-24
- Revision:
- 0:58ec626ffe1a
File content as of revision 0:58ec626ffe1a:
/************************************************************** / Simple program program to show basic program structure / / The program flashes onboard LED #1 on/off every 0.5 seconds for 25 seconds then waits 5 seconds and repeats. / /**************************************************************/ #include "mbed.h" DigitalOut myled(LED1); // use onboard LED #1 int main() { while(1) { // repeat indefinitely int x = 1; // set x as integer set to 1 while(x < 25) { x = x + 1; // adds 1 to the integer everytime it repeats myled = 1; // turn on LED #1 wait(0.5); // wait 0.5s myled = 0; // turn off LED #1 wait(0.5); // wait 0.5s } wait(5); // wait 5s } }