Vadim Gouskov 15-10-18 Vote Controller Version 1

Dependencies:   MQTT

Fork of PGO6_VoteController_template by Jens de hoog

Revision:
3:e234aaf2a634
Parent:
2:5b7d055dbc91
--- a/main.cpp	Tue Oct 31 09:01:56 2017 +0000
+++ b/main.cpp	Mon Oct 15 15:53:31 2018 +0000
@@ -43,6 +43,31 @@
 
 int main(int argc, char* argv[])
 {
-
+    InterruptIn button(USER_BUTTON);
+    button.fall(callback(&button1_onpressed_cb));
+    button1_busy = false;
+    button1_enabled = true;
+    button1_pressed = false;
+    multiclick_state = 0;
+//    status_led = 0;   
+    
+    while(1){
+            if(debounced_flag){
+//                printf("debounced \r\n");
+//                printf("clicks %d\r\n", multiclick_state);
+//                printf("button_enabled %d\r\n", button1_enabled);
+//                printf("button_busy %d\r\n", button1_busy);
+                debounced_flag = false;
+                
+            }
+//                printf("button_enabled %d\r\n", button1_enabled);
+            if(done_counting){
+                printf("counted %d \r\n", multiclick_state);
+                // handle click amount here
+                multiclick_state = 0;
+                done_counting = false;         
+            }
+    }
+    
     return 0;
 }