4180 lab 1

Dependencies:   mbed MCP23S17 PinDetect USBDevice

Files at this revision

API Documentation at this revision

Comitter:
emilywilson
Date:
Tue Jan 21 20:54:41 2020 +0000
Parent:
9:be04caf5f990
Child:
11:2cfdab516b21
Commit message:
watchdog extra credit changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
watchdog_ec.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jan 21 20:37:31 2020 +0000
+++ b/main.cpp	Tue Jan 21 20:54:41 2020 +0000
@@ -3,10 +3,10 @@
 #include "PinDetect.h"
 //#include "part4.h"
 //#include "part6.h"
-#include "part7.h"
+//#include "part7.h"
 //#include "part8.h"
 //#include "part9.h"
-//#include "watchdog_ec.h"
+#include "watchdog_ec.h"
 
 //DigitalOut myled(p26);
 //PwmOut builtinLED(LED1);
@@ -105,6 +105,7 @@
         // Part 10 in separate project
         
         // Watchdog Extra Credit
+        run_watchdogEC();
         
     }
 }
--- a/watchdog_ec.h	Tue Jan 21 20:37:31 2020 +0000
+++ b/watchdog_ec.h	Tue Jan 21 20:54:41 2020 +0000
@@ -25,17 +25,19 @@
 DigitalOut myled(p26);
 
 int prev;
-int count = 0;
 
 int run_watchdogEC() {
     wdt.kick(10.0);
     
     prev = pb;
     
+    int count = 0;
+    
     while(1) {
         if (prev != pb) {
             count++;
         }
+        prev = pb;
         myled = !pb;
         
         if (count == 2) {