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.
Dependencies: mbed
main.cpp@2:928931868ac8, 2016-11-10 (annotated)
- Committer:
- Goran002
- Date:
- Thu Nov 10 19:04:33 2016 +0000
- Revision:
- 2:928931868ac8
- Parent:
- 1:bf24c62c6310
VT2_ Goran Herek
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Goran002 | 0:d2afa897dbc9 | 1 | #include "mbed.h" |
Goran002 | 1:bf24c62c6310 | 2 | InterruptIn button(p18); // Interrupt on digital pushbutton input p18 |
Goran002 | 1:bf24c62c6310 | 3 | DigitalOut led1(p5); // digital out to p5 |
Goran002 | 1:bf24c62c6310 | 4 | void toggle(void); // function prototype |
Goran002 | 2:928931868ac8 | 5 | int main() |
Goran002 | 2:928931868ac8 | 6 | { |
Goran002 | 2:928931868ac8 | 7 | button.rise(&toggle); // attach the address of the toggle |
Goran002 | 1:bf24c62c6310 | 8 | } // function to the rising edge |
Goran002 | 2:928931868ac8 | 9 | void toggle() |
Goran002 | 2:928931868ac8 | 10 | { |
Goran002 | 2:928931868ac8 | 11 | led1=!led1; |
Goran002 | 0:d2afa897dbc9 | 12 | } |