Matija Cecić
/
VjezbaV5_1
6.4 Tipkalo
Diff: main.cpp
- Revision:
- 0:63d97baa8786
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 10 18:24:29 2016 +0000 @@ -0,0 +1,12 @@ +#include "mbed.h" +InterruptIn button(p18); // Interrupt on digital pushbutton input p18 +DigitalOut led1(p5); // digital out to p5 +void toggle(void); // function prototype +int main() +{ + button.rise(&toggle); // attach the address of the toggle +} // function to the rising edge +void toggle() +{ + led1=!led1; +} \ No newline at end of file