hack gt final code

Dependencies:   4DGL-uLCD-SE BMP085 PinDetect SDFileSystem mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
otis22894
Date:
Sun Sep 21 11:15:41 2014 +0000
Parent:
12:b301cb3cef44
Child:
14:23390a020d1c
Commit message:
TIME: 7:15AM

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Sep 21 11:05:21 2014 +0000
+++ b/main.cpp	Sun Sep 21 11:15:41 2014 +0000
@@ -65,6 +65,8 @@
 Timer breathTimer;
 bool next = false;
 bool adult = true;
+int cycleCount = 0;
+Ticker LEDTicker;
 
 void playMessage(string messageName);
 void getBreathing();
@@ -82,6 +84,7 @@
 void waitForNext();
 void tick();
 void welcomeLED();
+void cycleLEDs();
 
 int main(){
     repeatButton.mode(PullUp);
@@ -212,7 +215,11 @@
         wait(0.5);
     }
     uLCD.printf("BREATH DETECTED");
+    cycleLEDs();
+    LEDTicker.attach(&cycleLEDs,0.116);
+    //cycleLEDs();
     playMessage(BREATH_TONE);
+    LEDTicker.detach();
     ticker.detach();
     while(windSensorVoltage>6.15){
         windSensorVoltage = windSensor*10;
@@ -302,6 +309,37 @@
     auditVitals();
 }
 
+void cycleLEDs(){
+    cycleCount++;
+    if(cycleCount==1){
+        GLED1 = 1;
+    }
+    if(cycleCount==2){
+        GLED2 = 1;
+    }
+    if(cycleCount==3){
+        GLED3 = 1;
+    }
+    if(cycleCount==4){
+        RLED1 = 1;
+    }
+    if(cycleCount==5){
+        RLED2 = 1;
+    }
+    if(cycleCount==6){
+        RLED3 = 1;
+    }
+    if(cycleCount==7){
+        GLED1 = 0;
+        GLED2 = 0;
+        GLED3 = 0;
+        RLED1 = 0;
+        RLED2 = 0;
+        RLED3 = 0;
+        cycleCount = 0;
+    }
+}
+
 void welcomeLED(){
     for(int i =0;i<5;i++){
         GLED1 = 1;