10.11.2016.
Dependencies: mbed
main.cpp@0:6f27f45a3058, 2016-11-10 (annotated)
- Committer:
- kgrdosic
- Date:
- Thu Nov 10 18:24:35 2016 +0000
- Revision:
- 0:6f27f45a3058
vj. 6-4_Grdosic
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kgrdosic | 0:6f27f45a3058 | 1 | #include "mbed.h" |
kgrdosic | 0:6f27f45a3058 | 2 | InterruptIn button(p18); // Interrupt on digital pushbutton input p18 |
kgrdosic | 0:6f27f45a3058 | 3 | DigitalOut led1(p5); // digital out to p5 |
kgrdosic | 0:6f27f45a3058 | 4 | void toggle(void); // function prototype |
kgrdosic | 0:6f27f45a3058 | 5 | int main() |
kgrdosic | 0:6f27f45a3058 | 6 | { |
kgrdosic | 0:6f27f45a3058 | 7 | button.rise(&toggle); // attach the address of the toggle |
kgrdosic | 0:6f27f45a3058 | 8 | } // function to the rising edge |
kgrdosic | 0:6f27f45a3058 | 9 | void toggle() |
kgrdosic | 0:6f27f45a3058 | 10 | { |
kgrdosic | 0:6f27f45a3058 | 11 | led1=!led1; |
kgrdosic | 0:6f27f45a3058 | 12 | } |