All tasks complete

Dependencies:   mbed MCP23017 mbed-rtos WattBob_TextLCD

Revision:
9:2fd97246b8f0
Parent:
8:3f3f2c2e2046
Child:
10:2b262d810c67
diff -r 3f3f2c2e2046 -r 2fd97246b8f0 assignment3tasks.cpp
--- a/assignment3tasks.cpp	Tue Mar 26 21:42:14 2019 +0000
+++ b/assignment3tasks.cpp	Wed Mar 27 12:28:10 2019 +0000
@@ -242,5 +242,79 @@
         
         
         
+        
         }
-}    
\ No newline at end of file
+}
+
+void task9indLED()
+{
+    float delay = 1000 / TASKFREQ9;
+    while(true){
+        uint8_t turnleft = leftsw.read();
+        uint8_t turnright = rightsw.read();
+        
+        carstateXS.lock();
+        
+        
+
+       (turnleft = 1)?     info.leftind    =   1   :info.leftind   =    0;
+       (turnright = 1)?    info.rightind   =   1   :info.rightind  =    0; 
+        
+       /* if(turnleft = 1){
+          info.leftind = 1;
+          }
+        else{
+          info.leftind = 0;
+          }
+          
+        if(turnleft = 1){
+          info.rightind = 1;
+          }
+        else{
+          info.rightind = 0;
+          }
+             */
+          
+        carstateXS.unlock();
+        
+        //hazard and other lights
+        
+        float left_period = 1.0;
+        float right_period = 1.0;
+        float left_pulswidth = 0.0;
+        float right_pulswidth = 0.0;
+
+        if (turnleft != 0)
+        {
+            left_period = (1/TASKFREQ9);
+            left_pulswidth = (1/(2*TASKFREQ9)); 
+        }
+        if (turnright!= 0)
+        {
+            right_period = (1/TASKFREQ9);
+            right_pulswidth = (1/TASKFREQ9);
+        }
+        if (turnleft != 0 && turnright != 0)
+        {
+            left_period = left_period / 2;
+            left_pulswidth = left_pulswidth / 2;
+            right_period = right_period / 2;
+            right_pulswidth = right_pulswidth / 2;   
+        }
+        
+        leftind.period(left_period);
+        leftind.pulsewidth(left_pulswidth);
+        rightind.period(right_period);
+        rightind.pulsewidth(right_pulswidth);
+       
+       float delay = 1000 / TASKFREQ9S2;
+       Thread::wait((int)delay);
+        
+        
+        
+        }
+
+
+
+
+}        
\ No newline at end of file