1b

Dependencies:   mbed

Committer:
sthompson
Date:
Fri Sep 22 15:09:27 2017 +0000
Revision:
0:05c51616e753
1b

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sthompson 0:05c51616e753 1 /**************************************************************
sthompson 0:05c51616e753 2 / Simple program program to show basic program structure
sthompson 0:05c51616e753 3 /
sthompson 0:05c51616e753 4 / The program flashes onboard LED #1 on/off at a rate of 2Hz
sthompson 0:05c51616e753 5 /
sthompson 0:05c51616e753 6 /**************************************************************/
sthompson 0:05c51616e753 7
sthompson 0:05c51616e753 8 #include "mbed.h"
sthompson 0:05c51616e753 9
sthompson 0:05c51616e753 10 DigitalOut myled1(LED1); // use onboard LED #1
sthompson 0:05c51616e753 11 DigitalOut myled2(LED2); // use onboard LED #1
sthompson 0:05c51616e753 12 DigitalOut myled3(LED3); // use onboard LED #1
sthompson 0:05c51616e753 13 DigitalOut myled4(LED4);
sthompson 0:05c51616e753 14
sthompson 0:05c51616e753 15 int main() {
sthompson 0:05c51616e753 16
sthompson 0:05c51616e753 17 while(1) { // repeat indefinitely
sthompson 0:05c51616e753 18 myled1 = 1;
sthompson 0:05c51616e753 19 myled2 = 1;
sthompson 0:05c51616e753 20 myled3 = 1;
sthompson 0:05c51616e753 21 myled4 = 1;
sthompson 0:05c51616e753 22 wait(0.0625);
sthompson 0:05c51616e753 23 myled4 = 0;
sthompson 0:05c51616e753 24 wait(0.0625);
sthompson 0:05c51616e753 25 myled3 = 0;
sthompson 0:05c51616e753 26 myled4 = 1;
sthompson 0:05c51616e753 27 wait(0.0625);
sthompson 0:05c51616e753 28 myled4 = 0;
sthompson 0:05c51616e753 29 wait(0.0625);
sthompson 0:05c51616e753 30 myled3 = 1;
sthompson 0:05c51616e753 31 myled4 = 1;
sthompson 0:05c51616e753 32 myled2 = 0;
sthompson 0:05c51616e753 33 wait(0.0625);
sthompson 0:05c51616e753 34 myled4 = 0;
sthompson 0:05c51616e753 35 wait(0.0625);
sthompson 0:05c51616e753 36 myled4 = 1;
sthompson 0:05c51616e753 37 myled3 = 0;
sthompson 0:05c51616e753 38 wait(0.0625);
sthompson 0:05c51616e753 39 myled4 = 0;
sthompson 0:05c51616e753 40 wait(0.0625);
sthompson 0:05c51616e753 41 myled4 = 1;
sthompson 0:05c51616e753 42 myled3 = 1;
sthompson 0:05c51616e753 43 myled2 = 1;
sthompson 0:05c51616e753 44 myled1 = 0;
sthompson 0:05c51616e753 45 wait(0.0625);
sthompson 0:05c51616e753 46 myled4 = 0;
sthompson 0:05c51616e753 47 wait(0.0625);
sthompson 0:05c51616e753 48 myled3 = 0;
sthompson 0:05c51616e753 49 myled4 = 1;
sthompson 0:05c51616e753 50 wait(0.0625);
sthompson 0:05c51616e753 51 myled4 = 0;
sthompson 0:05c51616e753 52 wait(0.0625);
sthompson 0:05c51616e753 53 myled3 = 1;
sthompson 0:05c51616e753 54 myled4 = 1;
sthompson 0:05c51616e753 55 myled2 = 0;
sthompson 0:05c51616e753 56 wait(0.0625);
sthompson 0:05c51616e753 57 myled4 = 0;
sthompson 0:05c51616e753 58 wait(0.0625);
sthompson 0:05c51616e753 59 myled4 = 1;
sthompson 0:05c51616e753 60 myled3 = 0;
sthompson 0:05c51616e753 61 wait(0.0625);
sthompson 0:05c51616e753 62 myled4 = 0;
sthompson 0:05c51616e753 63 wait(0.0625);
sthompson 0:05c51616e753 64 myled4 = 1;
sthompson 0:05c51616e753 65 myled3 = 1;
sthompson 0:05c51616e753 66 myled2 = 1;
sthompson 0:05c51616e753 67 myled1 = 1;
sthompson 0:05c51616e753 68
sthompson 0:05c51616e753 69
sthompson 0:05c51616e753 70 }
sthompson 0:05c51616e753 71 }