gdfgdh

Dependencies:   ELEC350-Practicals-FZ429

Fork of Task633-mbedos-FZ429 by University of Plymouth - Stages 1, 2 and 3

Files at this revision

API Documentation at this revision

Comitter:
noutram
Date:
Tue Nov 21 11:53:44 2017 +0000
Parent:
13:f05daa68720c
Commit message:
Updated for FZ429

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f05daa68720c -r 03836b560d3d main.cpp
--- a/main.cpp	Tue Nov 21 11:36:41 2017 +0000
+++ b/main.cpp	Tue Nov 21 11:53:44 2017 +0000
@@ -88,6 +88,8 @@
 //Normal priority thread (consumer)
 void thread1() 
 {      
+    static int counter = 0;
+    
     while (true) {
         //Block on the queue
         osEvent evt = mail_box.get();
@@ -104,10 +106,22 @@
             printf("ADC Value: %.2f\t",    msg.adcValue);
             printf("SW1: %u\t",             msg.sw1State);
             printf("SW2: %u\n\r",             msg.sw2State);
+            
+            //Toggle green
+            if ( (msg.sw1State == 1) && (msg.sw2State == 1)) {
+                counter++;
+                if (counter == 10) {
+                    greenLED = !greenLED;
+                    counter = 0;
+                }   
+            } else {
+                counter = 0;   
+            }            
+            
         } else {
             printf("ERROR: %x\n\r", evt.status);   
         }  
-        
+                
     } //end while
 }