Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
main.cpp@57:a3c0babfccea, 2018-01-23 (annotated)
- Committer:
- bhimebau
- Date:
- Tue Jan 23 20:23:54 2018 +0000
- Revision:
- 57:a3c0babfccea
- Parent:
- 56:939270a94e87
- Child:
- 58:f1306dbfb574
Program to push buttons;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jonathan Austin |
0:2757d7abb7d9 | 1 | #include "mbed.h" |
| Jonathan Austin |
0:2757d7abb7d9 | 2 | |
| Jonathan Austin |
0:2757d7abb7d9 | 3 | DigitalOut led1(LED1); |
| bhimebau | 57:a3c0babfccea | 4 | Serial pc(USBTX, USBRX); |
| bhimebau | 57:a3c0babfccea | 5 | DigitalIn button(PC_13); |
| Jonathan Austin |
0:2757d7abb7d9 | 6 | |
| Jonathan Austin |
1:846c97078558 | 7 | // main() runs in its own thread in the OS |
| Jonathan Austin |
0:2757d7abb7d9 | 8 | int main() { |
| Jonathan Austin |
0:2757d7abb7d9 | 9 | while (true) { |
| bhimebau | 57:a3c0babfccea | 10 | if (button.read()) led1 = 1; |
| bhimebau | 57:a3c0babfccea | 11 | else led1=0; |
| bhimebau | 57:a3c0babfccea | 12 | //pc.putc(pc.getc()); |
| bhimebau | 57:a3c0babfccea | 13 | //led1 = !led1; |
| bhimebau | 57:a3c0babfccea | 14 | //if (led1) { |
| bhimebau | 57:a3c0babfccea | 15 | // pc.printf("ON\n\r"); |
| bhimebau | 57:a3c0babfccea | 16 | // wait(2); |
| bhimebau | 57:a3c0babfccea | 17 | // } |
| bhimebau | 57:a3c0babfccea | 18 | // else { |
| bhimebau | 57:a3c0babfccea | 19 | // pc.printf("OFF\n\r"); |
| bhimebau | 57:a3c0babfccea | 20 | // wait(1); |
| bhimebau | 57:a3c0babfccea | 21 | // } |
| bhimebau | 57:a3c0babfccea | 22 | |
| Jonathan Austin |
0:2757d7abb7d9 | 23 | } |
| Jonathan Austin |
0:2757d7abb7d9 | 24 | } |
| Jonathan Austin |
1:846c97078558 | 25 |
