prekid tipkalom

Files at this revision

API Documentation at this revision

Comitter:
atopcic
Date:
Mon Feb 22 08:25:18 2021 +0000
Commit message:
prekid tipkalom

Changed in this revision

Interupt.cpp Show annotated file Show diff for this revision Revisions of this file
Interupt.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 11c592a697fb Interupt.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Interupt.cpp	Mon Feb 22 08:25:18 2021 +0000
@@ -0,0 +1,13 @@
+// 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
+}
\ No newline at end of file
diff -r 000000000000 -r 11c592a697fb Interupt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Interupt.h	Mon Feb 22 08:25:18 2021 +0000
@@ -0,0 +1,10 @@
+#ifndef RESET_POLJA_H
+#define RESET_POLJA_H
+#include "mbed.h"
+
+extern Timer debounce;
+extern int StartStop;
+extern InterruptIn button;
+ void Interupt (void);
+ #endif 
+