newest

Dependencies:   BME280 BMP280 TextLCD mbed

Fork of CW_watchdog_08012018 by Calvin Kalintra

Files at this revision

API Documentation at this revision

Comitter:
ckalintra
Date:
Tue Jan 09 11:54:56 2018 +0000
Parent:
2:c696dfd53eeb
Commit message:
code

Changed in this revision

data.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/data.h	Tue Jan 09 11:26:15 2018 +0000
+++ b/data.h	Tue Jan 09 11:54:56 2018 +0000
@@ -6,7 +6,7 @@
 float lvl;
 float data_temp [119], data_press[119], data_light[119];
 int date_a[199], time_a[199], time0_a[199], date0_a[199];
-BMP280 bmp(D14,D15,0x76);
+BMP280 bmp(D14,D15);
 
 AnalogIn LDR(A0);
 int counterw = 0, full = 0, day, month, year, leap;
--- a/main.cpp	Tue Jan 09 11:26:15 2018 +0000
+++ b/main.cpp	Tue Jan 09 11:54:56 2018 +0000
@@ -2,8 +2,9 @@
 #include "TextLCD.h"
 #include "BME280.h"
 #include "putty.h"
+#define watchdog_time 15
 //DigitalOut myled(LED1);
-int dislcd = 0;
+int dislcd = 0, wdcounter = 0, watchdog = 0;
 float T = 15;
 Ticker display;
 Ticker second_pass;
@@ -17,6 +18,10 @@
 void second_tick()
 {
     ss++;
+    if(watchdog == 1)
+    {
+        wdcounter++;
+    }
     time_rule();   
     day_check();
     lcd.cls();
@@ -35,8 +40,10 @@
         display_dates();
         display_time();
     }
-   
-       //VIC_SystemReset();
+   if (wdcounter >= watchdog_time)
+   {
+       NVIC_SystemReset();
+   }
 }
 
 void lcddisp()