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@42:ee570b89946e, 2017-10-12 (annotated)
- Committer:
- bigg55
- Date:
- Thu Oct 12 04:56:34 2017 +0000
- Revision:
- 42:ee570b89946e
- Parent:
- 29:0b58d21e87d6
Example Interrupts;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jonathan Austin |
0:2757d7abb7d9 | 1 | #include "mbed.h" |
| bigg55 | 42:ee570b89946e | 2 | |
| bigg55 | 42:ee570b89946e | 3 | InterruptIn enable(D0); //Button active LOW |
| bigg55 | 42:ee570b89946e | 4 | DigitalOut led(D1); |
| bigg55 | 42:ee570b89946e | 5 | DigitalOut flash(D2); |
| bigg55 | 42:ee570b89946e | 6 | void flip() { |
| bigg55 | 42:ee570b89946e | 7 | led = !led; |
| bigg55 | 42:ee570b89946e | 8 | } |
| bigg55 | 42:ee570b89946e | 9 | |
| Jonathan Austin |
0:2757d7abb7d9 | 10 | int main() { |
| bigg55 | 42:ee570b89946e | 11 | enable.rise(&flip); // attach the address of the flip function to the rising edge |
| bigg55 | 42:ee570b89946e | 12 | while(1) { // wait around, interrupts will interrupt this! |
| bigg55 | 42:ee570b89946e | 13 | flash = !flash; |
| bigg55 | 42:ee570b89946e | 14 | wait(5); |
| Jonathan Austin |
0:2757d7abb7d9 | 15 | } |
| bigg55 | 42:ee570b89946e | 16 | |
| Jonathan Austin |
0:2757d7abb7d9 | 17 | } |
