Sebastian Barrera / Mbed OS Lab6
Revision:
10:0edd1ab03f84
Parent:
9:5d1d36c2664f
Child:
11:e697f0c49466
--- a/main.cpp	Thu Mar 26 11:02:19 2020 +0000
+++ b/main.cpp	Thu Apr 02 18:01:13 2020 +0000
@@ -1,11 +1,14 @@
 #include "mbed.h"
 #include "wdt.h"
-// Watchdog with better fault coverage
+// Lab 6
 // ---------------------------------
 //    * Three threads co-operate to flash two LEDs
 //    * A simple way to inject a fault, by pressing a button 
 //    * The watchdog is configured with a 1024ms timeout
-//    * If hardware fails, set flag to trigger watchdog so it resets the system 
+//    * To kick the watchdog, both LED threads must set a signal that is received by another thread which kicks it
+//    * If hardware fails, turn on red on-board LED.
+
+//This code was tested, since I had the KL25Z available
 
 #define ON 1
 #define OFF 0
@@ -118,7 +121,7 @@
             volts=volts*3.3;
             volts2=anin.read()*3.3;
             //Voltage with LEDs on is around 1.2V, since the resistances available were not of 680ohms.
-            if (volts>1.5 || volts2>1.5){redled=0;}//Set a signal to detect fault
+            if (volts>1.5 || volts2>1.5 || volts<0.5 || volts2<0.5){redled=0;}//Turn on on-board LED
         }
         //printf("volts: %f volts 2: %f", volts, volts2);//Debugging
         volts=0; volts2=0;