New group

Dependencies:   mbed

Fork of TAIST_modbus by Supachai Vorapojpisut

Revision:
18:47f0da1f232b
Parent:
17:98631c9faf5f
Child:
22:fcde97240c38
--- a/main.cpp	Wed Mar 14 14:28:46 2018 +0000
+++ b/main.cpp	Wed Mar 14 14:41:12 2018 +0000
@@ -25,11 +25,13 @@
 void released_cunt()
 {
      cunt_released = cunt_released+1;
+     cunt_pressed = 0;
 }
 
 void pressed_cunt()
 {
       cunt_pressed =  cunt_pressed+1;
+      cunt_released = 0;
 }
 
 void pressed()
@@ -39,7 +41,6 @@
             y = cunt_released;
             modbus_update(0, y);
             printf("released = %.1f sec\n",modbus_read(0)*0.1);
-            cunt_released = 0;
         }
     if(button==0){
         ticker.attach(callback(&pressed_cunt),0.1);
@@ -53,7 +54,6 @@
             x = cunt_pressed;
             modbus_update(1, x);
             printf("pressed = %.1f sec\n",modbus_read(1)*0.1);
-            cunt_pressed = 0;
         }
     if(button==1){
         ticker.attach(callback(&released_cunt),0.1);