Paul Stewart
/
ME21001_Lab02_Exercise_02
Lab 2
main.cpp@0:bc9f80ce1629, 2016-09-24 (annotated)
- Committer:
- pdstewart
- Date:
- Sat Sep 24 19:54:22 2016 +0000
- Revision:
- 0:bc9f80ce1629
Lab 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pdstewart | 0:bc9f80ce1629 | 1 | #include "mbed.h" |
pdstewart | 0:bc9f80ce1629 | 2 | |
pdstewart | 0:bc9f80ce1629 | 3 | DigitalOut myled(LED1); // use onboard LED #1 |
pdstewart | 0:bc9f80ce1629 | 4 | |
pdstewart | 0:bc9f80ce1629 | 5 | int main() { |
pdstewart | 0:bc9f80ce1629 | 6 | while(1) { // repeat indefinitely |
pdstewart | 0:bc9f80ce1629 | 7 | myled = 1; // turn on LEd # 1 |
pdstewart | 0:bc9f80ce1629 | 8 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 9 | myled = 0; // turn off LED # 1 |
pdstewart | 0:bc9f80ce1629 | 10 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 11 | myled = 1; // turn on LEd # 1 |
pdstewart | 0:bc9f80ce1629 | 12 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 13 | myled = 0; // turn off LED # 1 |
pdstewart | 0:bc9f80ce1629 | 14 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 15 | myled = 1; // turn on LEd # 1 |
pdstewart | 0:bc9f80ce1629 | 16 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 17 | myled = 0; // turn off LED # 1 |
pdstewart | 0:bc9f80ce1629 | 18 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 19 | myled = 1; // turn on LEd # 1 |
pdstewart | 0:bc9f80ce1629 | 20 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 21 | myled = 0; // turn off LED # 1 |
pdstewart | 0:bc9f80ce1629 | 22 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 23 | myled = 1; // turn on LEd # 1 |
pdstewart | 0:bc9f80ce1629 | 24 | wait(1); // wait 1s |
pdstewart | 0:bc9f80ce1629 | 25 | myled = 0; // turn off LED # 1 |
pdstewart | 0:bc9f80ce1629 | 26 | wait(5); // wait 5s |
pdstewart | 0:bc9f80ce1629 | 27 | } |
pdstewart | 0:bc9f80ce1629 | 28 | |
pdstewart | 0:bc9f80ce1629 | 29 | } |