Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 4:bfe306335065
- Parent:
- 2:1dece5699c8b
- Child:
- 5:0d9e292a9d06
--- 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