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 InterruptIn_HelloWorld by
main.cpp@5:89938cffed21, 2018-05-11 (annotated)
- Committer:
- ctasdemir
- Date:
- Fri May 11 05:09:48 2018 +0000
- Revision:
- 5:89938cffed21
- Parent:
- 3:f729f0421740
InterruptIn
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbed_official | 0:7a20a6aa1f5e | 1 | #include "mbed.h" |
| mbed_official | 0:7a20a6aa1f5e | 2 | |
| ctasdemir | 5:89938cffed21 | 3 | InterruptIn button(USER_BUTTON); // pull-up |
| ctasdemir | 5:89938cffed21 | 4 | DigitalOut led(LED2); |
| ctasdemir | 5:89938cffed21 | 5 | DigitalOut flash(PA_7); // PA_7 --> D11 pin |
| mbed_official | 0:7a20a6aa1f5e | 6 | |
| mbed_official | 0:7a20a6aa1f5e | 7 | void flip() { |
| mbed_official | 0:7a20a6aa1f5e | 8 | led = !led; |
| mbed_official | 0:7a20a6aa1f5e | 9 | } |
| mbed_official | 0:7a20a6aa1f5e | 10 | |
| mbed_official | 0:7a20a6aa1f5e | 11 | int main() { |
| ctasdemir | 5:89938cffed21 | 12 | button.fall(&flip); |
| ctasdemir | 5:89938cffed21 | 13 | while(1) { |
| mbed_official | 0:7a20a6aa1f5e | 14 | flash = !flash; |
| mbed_official | 0:7a20a6aa1f5e | 15 | wait(0.25); |
| mbed_official | 0:7a20a6aa1f5e | 16 | } |
| mbed_official | 0:7a20a6aa1f5e | 17 | } |
