Working read code with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Testnew by BAT

Revision:
34:e87bb6e83072
Parent:
29:b2e53ce54b3e
Child:
35:3090ec93b4aa
--- a/button.cpp	Fri Nov 17 16:24:33 2017 +0000
+++ b/button.cpp	Mon Nov 20 15:46:11 2017 +0000
@@ -3,7 +3,9 @@
 #include "emic2.h"
 
 //emic2 myTTS(p28, p27); //serial RX,TX pins to emic
-//DigitalOut led4(LED4);
+DigitalOut led4(LED4);
+DigitalOut led3(LED3);
+DigitalOut led2(LED2);
 
 // button constructor
 button::button(PwmOut servo, DigitalIn pb, int id)
@@ -72,6 +74,38 @@
         servo = i/100.0;
         wait(0.01);
     }
+    switch (id) {
+        case 1:
+            led2 = 0;
+            led3 = 0;
+            led4 = 1;
+            break;
+        case 2:
+            led2 = 0;
+            led3 = 1;
+            led4 = 0;
+            break;
+        case 3:
+            led2 = 0;
+            led3 = 1;
+            led4 = 1;
+            break;
+        case 4:
+            led2 = 1;
+            led3 = 0;
+            led4 = 0;
+            break;
+        case 5:
+            led2 = 1;
+            led3 = 0;
+            led4 = 1;
+            break;
+        case 6:
+            led2 = 1;
+            led3 = 1;
+            led4 = 0;
+            break;
+    }
 }
 
 // move servo out of the slot
@@ -82,6 +116,9 @@
         servo = i/100.0;
         wait(0.01);
     }
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
 }
 
 int button::updateState()