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