Sistemas Embebidos / Mbed 2 deprecated Antirrebote_Puls

Dependencies:   mbed

Revision:
1:7b39e7307343
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PRUEBA1_LIB_ANTIREBOTE.cpp	Thu May 03 23:33:41 2018 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "antirrebote.h"
+
+DigitalOut LR(LED1);
+DigitalOut LV(LED2);
+
+
+AntReb detector_pulso;
+
+Ticker timer;
+
+char tiempo = 15;
+
+void attime(void);
+
+int main()
+{   LR = 1;
+    LV = 1;
+    char prendete = 1;
+    timer.attach(&attime, 0.001);
+    while(1)
+    {
+        detector_pulso.setPin(PTE5);
+        if(tiempo == 0)
+        {
+        tiempo = 15;
+        prendete = detector_pulso.antiRebote();
+        }
+        if(prendete == 0)
+            LR = 0;
+        if (prendete==1)
+            LR=1;
+    }
+}
+
+void attime (void)
+{
+    if(tiempo > 0){
+        tiempo--;
+    }
+}
\ No newline at end of file