UoD ME21001 Group 2 02 / Mbed 2 deprecated exercise4

Dependencies:   mbed

Committer:
matt495
Date:
Tue Sep 25 16:01:36 2018 +0000
Revision:
0:9a2d6e5f53d0
ME21001 exercise 4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
matt495 0:9a2d6e5f53d0 1 /****************************************************************
matt495 0:9a2d6e5f53d0 2 / Simple program to show basic program structure
matt495 0:9a2d6e5f53d0 3 /
matt495 0:9a2d6e5f53d0 4 / The program flashes onboard LED #1, #2 and #3 on/off in sequence for 1 second and continues this indefinitely.
matt495 0:9a2d6e5f53d0 5 *************************************************************/
matt495 0:9a2d6e5f53d0 6
matt495 0:9a2d6e5f53d0 7 #include "mbed.h"
matt495 0:9a2d6e5f53d0 8
matt495 0:9a2d6e5f53d0 9 DigitalOut myled(p23); // use onboard LED #1 (red)
matt495 0:9a2d6e5f53d0 10 DigitalOut myled2(p25); // use onboard LED #2 (green)
matt495 0:9a2d6e5f53d0 11 DigitalOut myled3(p24); // use onboard LED #3 (yellow)
matt495 0:9a2d6e5f53d0 12
matt495 0:9a2d6e5f53d0 13 int main() {
matt495 0:9a2d6e5f53d0 14
matt495 0:9a2d6e5f53d0 15 while(1) { // repeat indefinitely
matt495 0:9a2d6e5f53d0 16 myled = 1; // turn on LED #1
matt495 0:9a2d6e5f53d0 17 myled2 = 1; // turn on LED #2
matt495 0:9a2d6e5f53d0 18 myled3 = 1; // turn on LED #3
matt495 0:9a2d6e5f53d0 19 wait(1); // wait 1s
matt495 0:9a2d6e5f53d0 20 myled = 0; // turn off LED #1
matt495 0:9a2d6e5f53d0 21 myled2 = 0; // turn off LED #2
matt495 0:9a2d6e5f53d0 22 myled3 = 0; // turn off LED #3
matt495 0:9a2d6e5f53d0 23 wait(1); // wait 1s
matt495 0:9a2d6e5f53d0 24 }
matt495 0:9a2d6e5f53d0 25 }