UoD ME21001 Group 2 02 / Mbed 2 deprecated exercise2

Dependencies:   mbed

Committer:
matt495
Date:
Tue Sep 25 16:00:40 2018 +0000
Revision:
0:c1a2bfdd2087
ME21001 exercise 2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
matt495 0:c1a2bfdd2087 1 /****************************************************************
matt495 0:c1a2bfdd2087 2 / Simple program to show basic program structure
matt495 0:c1a2bfdd2087 3 /
matt495 0:c1a2bfdd2087 4 / The program flashes onboard LED #1 on/off 5 times, one second on and one second off. It then waits 5s before starting again.
matt495 0:c1a2bfdd2087 5 /***************************************************************/
matt495 0:c1a2bfdd2087 6
matt495 0:c1a2bfdd2087 7 #include "mbed.h"
matt495 0:c1a2bfdd2087 8
matt495 0:c1a2bfdd2087 9 DigitalOut myled(LED1); // use onboard LED #1
matt495 0:c1a2bfdd2087 10
matt495 0:c1a2bfdd2087 11 int main() {
matt495 0:c1a2bfdd2087 12
matt495 0:c1a2bfdd2087 13 while(1) { // repeat indefinitely
matt495 0:c1a2bfdd2087 14 for(int i=0; i<5; i++) { // set number of loops to 5
matt495 0:c1a2bfdd2087 15 myled = 1; // turn on LED #1
matt495 0:c1a2bfdd2087 16 wait(1.0); // wait 1s
matt495 0:c1a2bfdd2087 17 myled = 0; // turn off LED #1
matt495 0:c1a2bfdd2087 18 wait(1.0); // wait 1s
matt495 0:c1a2bfdd2087 19 }
matt495 0:c1a2bfdd2087 20 wait (5.0); // wait 5s
matt495 0:c1a2bfdd2087 21 }
matt495 0:c1a2bfdd2087 22 }