yes Spada / Mbed OS programme
Revision:
4:bfe306335065
Parent:
2:1dece5699c8b
Child:
5:0d9e292a9d06
diff -r 951985127bca -r bfe306335065 main.cpp
--- a/main.cpp	Tue Mar 05 09:17:15 2019 +0000
+++ b/main.cpp	Tue Mar 05 10:27:40 2019 +0000
@@ -2,54 +2,30 @@
 #include "rtos.h"
 
 #include "Logger.h"
-#include "BusyWaiter.h"
-
-
-//  Set the used LED
-DigitalOut led1(LED1);
 
-//  Set the duration between the LED's blinking
-int wait_time = 1000;
+#include "NRFDevKit.h"
+#include "WeatherStation.h"
 
-//  Set the basic waiting mechanism
-BusyWaiter busy_waiter;
 
 //  Set the logger handler
 Logger logger(true);
 
+NRFDevKit devKit(logger);
+
+WeatherStation weather(devKit, logger);
 
 int main () {
     
-    //  Waiting for the console connection
-    busy_waiter.wait(2000);
-    
     logger.log("Code written by Loic Guibert.\r\n");
     
-    //  defining which waiting mechanism we want to use
-    bool deep_sleep_mode = true;
+    //  Gives the mode
+    logger.log("Entering blinking state.\r\n");
+    //while(true) {
+        
+        //devKit.blink1();
+        //ThisThread::sleep_for(1000);
+    //}
     
-    //  Gives the mode
-    logger.log("Entering blinking state. Deep Mode: %s.\r\n", deep_sleep_mode ? "true" : "false");
-    
-    while (true) {
-        //  Blink LED by inversing its state
-        led1 = !led1;
+    weather.start();
 
-        if (deep_sleep_mode) {
-            /*  As seen on the TP1's doc:
-             *  Using the ThisThread::sleep_for() method: this method allows the CPU to 
-             *  enter deep sleep mode and thus to reduce power consumption between events.
-             */
-            ThisThread::sleep_for(wait_time);
-        } else {
-            /*  As seen on the TP1's doc:
-                Using the BusyWaiter::wait() method w- the class is provided to you and
-             *  you must include it into your project.
-             */
-            busy_waiter.wait(wait_time);
-        }
-    
-        logger.log("LED state: %01d.\r\n", led1.read());
-
-    }
 }
\ No newline at end of file