Mjerenje napona - 03.11
Dependencies: mbed
Fork of VT1_Pervan by
main.cpp
- Committer:
- fpervan
- Date:
- 2016-11-10
- Revision:
- 4:01e6c90b206d
- Parent:
- 3:30a434029ace
- Child:
- 5:0406c84a3d6f
File content as of revision 4:01e6c90b206d:
#include "mbed.h" InterruptIn button(p18); // Interrupt on digital pushbutton input p18 DigitalOut led1(p5); // digital out to p5 Timer debounce; // define debounce timer void toggle(void); // function prototype int main() { debounce.start(); button.rise(&toggle); // attach the address of the toggle } // function to the rising edge void toggle() { if (debounce.read_ms()>200) // only allow toggle if debounce timer led1=!led1; // has passed 200 ms debounce.reset(); // restart timer when the toggle is performed }