This program is an advanced "IoT" thermometer using LM75B component library. It displays the current value to the Serial host in Celcius or Fahrenheit (possible to change using a switch). It also stores an historic and displays it to the user using the LCD screen. Moreover, you can change the orientation of the screen by turning the device, just like a smartphone.
Dependencies: C12832 FXOS8700CQ LM75B mbed
Revision 8:6f30f477fa23, committed 2016-02-23
- Comitter:
- co838_gtvl2
- Date:
- Tue Feb 23 18:13:35 2016 +0000
- Parent:
- 7:e5732637dfd0
- Commit message:
- V1.0.1; Updated init of variables and LEDs; Removed unused file
Changed in this revision
--- a/MyTimeout.cpp Tue Feb 23 16:57:15 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#include "MyTimeout.h" \ No newline at end of file
--- a/MyTimeout.hpp Tue Feb 23 16:57:15 2016 +0000 +++ b/MyTimeout.hpp Tue Feb 23 18:13:35 2016 +0000 @@ -8,7 +8,7 @@ * It allows me to check if there is a function attached to a timeout. * Thanks to this, it can prevent a timeout to be attached if there is already one running. * It is useful in my case for the sleep() + interrupts so I don't lose process cylces. - * The function MUST be detached from the timeout using detach() method. + * The function *MUST* be detached from the timeout using detach() method. * * You can check the usage in the main.cpp file at the end of the main() function. */ @@ -17,9 +17,6 @@ public: bool hasAttachment() { -#if defined _DEBUG - pc.printf("Has function ? %c\r\n", (this->_function != NULL ? 'Y' : 'N')); -#endif return (this->_function != NULL); } };
--- a/main.cpp Tue Feb 23 16:57:15 2016 +0000 +++ b/main.cpp Tue Feb 23 18:13:35 2016 +0000 @@ -42,14 +42,16 @@ { celcius = !celcius; - if (celcius) { - r_led = 1.0; - g_led = 1.0; - b_led = 0.0; - } else { - r_led = 1.0; - g_led = 0.0; - b_led = 1.0; + if (running) { + if (celcius) { + r_led = 1.0; + g_led = 1.0; + b_led = 0.0; + } else { + r_led = 1.0; + g_led = 0.0; + b_led = 1.0; + } } } @@ -138,20 +140,17 @@ pc.printf("Hello gtvl2, from FRDM-K64F!\r\nUse POT1 to change the refresh rate, POT2 to change the scale of the graphic, SW2 or keyboard to change the unit and SW3 to pause.\r\n"); } - /* - * Thermal unit control - */ + // Initialize control interrupts sw2_int.mode(PullUp); sw2_int.fall(&sw2_interrupt); - pc.attach(&host_interrupt); sw3_int.mode(PullUp); sw3_int.fall(&sw3_interrupt); - - r_led = 1.0; - g_led = 1.0; - b_led = 0.0; + pc.attach(&host_interrupt); + + // Initialize variables and LEDs + running = false; celcius = true; - running = true; + sw3_interrupt(); // Do once process_function();