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.
main.cpp@0:d3ea274bc4c5, 2022-05-22 (annotated)
- Committer:
- hughbellinger
- Date:
- Sun May 22 20:10:52 2022 +0000
- Revision:
- 0:d3ea274bc4c5
1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hughbellinger | 0:d3ea274bc4c5 | 1 | #include "mbed.h" |
| hughbellinger | 0:d3ea274bc4c5 | 2 | InterruptIn button(p5); |
| hughbellinger | 0:d3ea274bc4c5 | 3 | DigitalOut led(LED1); |
| hughbellinger | 0:d3ea274bc4c5 | 4 | DigitalOut flash(LED2); |
| hughbellinger | 0:d3ea274bc4c5 | 5 | void flip(){ |
| hughbellinger | 0:d3ea274bc4c5 | 6 | led=1; |
| hughbellinger | 0:d3ea274bc4c5 | 7 | wait(0.2); |
| hughbellinger | 0:d3ea274bc4c5 | 8 | led=0; |
| hughbellinger | 0:d3ea274bc4c5 | 9 | wait(0.2); |
| hughbellinger | 0:d3ea274bc4c5 | 10 | } |
| hughbellinger | 0:d3ea274bc4c5 | 11 | |
| hughbellinger | 0:d3ea274bc4c5 | 12 | int main() { |
| hughbellinger | 0:d3ea274bc4c5 | 13 | button.rise(&flip); |
| hughbellinger | 0:d3ea274bc4c5 | 14 | while(1) { |
| hughbellinger | 0:d3ea274bc4c5 | 15 | flash = 1; |
| hughbellinger | 0:d3ea274bc4c5 | 16 | wait(0.2); |
| hughbellinger | 0:d3ea274bc4c5 | 17 | led = 0; |
| hughbellinger | 0:d3ea274bc4c5 | 18 | wait(0.2); |
| hughbellinger | 0:d3ea274bc4c5 | 19 | } |
| hughbellinger | 0:d3ea274bc4c5 | 20 | } |