![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
demo program for th02 disco l072
Dependencies: mbed driver_mbed_TH02
Diff: main.cpp
- Revision:
- 0:af8ebf004802
diff -r 000000000000 -r af8ebf004802 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jan 25 16:37:24 2021 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "driver_mbed_TH02.h" +/* +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + +InterruptIn mybutton(USER_BUTTON); +*/ +double tempo = 0.3; // LED blinking delay + +// Change LEDs blinking frequency +void change_blinking_frequency() { + if (tempo == 0.3) // If leds have low frequency + tempo = 0.1; // Set the fast frequency + else // If leds have fast frequency + tempo = 0.3; // Set the low frequency +} + +int main() { + float fTemp,fHumid; + + + + while(1) { + fTemp=myTH02.ReadTemperature(); + printf("\r\n temp=%f",fTemp); + fHumid=myTH02.ReadHumidity(); + printf("\r\n humid=%f",fHumid); + wait(tempo); // wait tempo + + } +}