heart for pacemaker

Dependencies:   TextLCD mbed-rtos mbed

Revision:
1:82631d83e51e
Parent:
0:08412491e70f
Child:
2:2bae2020ac36
--- a/main.cpp	Mon Nov 28 20:40:31 2016 +0000
+++ b/main.cpp	Wed Nov 30 20:52:41 2016 +0000
@@ -20,7 +20,7 @@
 
 //constants
 
-const int minwait_A = 10;
+const int minwait_A = 10; //all in msec
 const int minwait_V = 20;
 const int LRI = 1000;
 const int VRP = 400;
@@ -28,13 +28,24 @@
 const int URI = 1000;
 const int AVI = 100;
 
+void random_mode() {
+    if(a_time >= min_waitA) {
+        send_signal(0);
+        a_time = 0;    
+    }
+    if(v_time >= min_waitV) {
+        send_signal(1);
+        v_time = 0;
+    }
+}
+
 void switch_modes() {
     switch(mode) {
-        case 0:
+        case 0: //becomes random
             break;
-        case 1:
+        case 1: //becomes manual
             break;
-        case 2:
+        case 2: //becomes test
             break;
         
     }    
@@ -59,13 +70,16 @@
         switch(type) {
             case 0:
                 a_signal = 1;
+                natAPace = 1;
             case 1:
                 v_signal = 1;
+                natVPace = 1;
         }
-        //TODO: Determine if time is right (is this supposed to be minWait?)
         wait(1); 
-        a_sense = 0;
-        v_sense = 0;
+        a_signal = 0;
+        v_signal = 0;
+        natAPace = 0;
+        natVPace = 0
 }
 
 void heart_keyboard() {