prekid tipkalom

Interupt.cpp

Committer:
atopcic
Date:
2021-02-22
Revision:
0:11c592a697fb

File content as of revision 0:11c592a697fb:

// toggle:

#include "Interupt.h"

Timer debounce;
int StartStop=1;
InterruptIn button(D3); 

void toggle() {
if (debounce.read_ms()>200) // only allow toggle if debounce timer has passed 200 ms
   StartStop=!StartStop;
 debounce.reset(); // restart timer when the toggle is performed
}