Mjerenje napona - 03.11

Dependencies:   mbed

Fork of VT1_Pervan by Applied engineering Team

main.cpp

Committer:
fpervan
Date:
2016-11-10
Revision:
5:0406c84a3d6f
Parent:
4:01e6c90b206d
Child:
6:4c46c5ba3aa3

File content as of revision 5:0406c84a3d6f:

#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
}