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
MyTimeout.hpp@6:6c61186c8739, 2016-02-22 (annotated)
- Committer:
- co838_gtvl2
- Date:
- Mon Feb 22 19:09:17 2016 +0000
- Revision:
- 6:6c61186c8739
- Child:
- 8:6f30f477fa23
New version (might be FINAL) including sleep() for lowering power consumption and MyTimeout (custom class of Timeout) to deal with interrupts without breaking cycle delay. No more RTOS Thread, now using Serial::attach() to deal with keyboard input.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
co838_gtvl2 | 6:6c61186c8739 | 1 | #ifndef _MYTIMEOUT_HPP_ |
co838_gtvl2 | 6:6c61186c8739 | 2 | # define _MYTIMEOUT_HPP_ |
co838_gtvl2 | 6:6c61186c8739 | 3 | |
co838_gtvl2 | 6:6c61186c8739 | 4 | # include "main.h" |
co838_gtvl2 | 6:6c61186c8739 | 5 | |
co838_gtvl2 | 6:6c61186c8739 | 6 | /* |
co838_gtvl2 | 6:6c61186c8739 | 7 | * This is my extended version over the Timeout class. |
co838_gtvl2 | 6:6c61186c8739 | 8 | * It allows me to check if there is a function attached to a timeout. |
co838_gtvl2 | 6:6c61186c8739 | 9 | * Thanks to this, it can prevent a timeout to be attached if there is already one running. |
co838_gtvl2 | 6:6c61186c8739 | 10 | * It is useful in my case for the sleep() + interrupts so I don't lose process cylces. |
co838_gtvl2 | 6:6c61186c8739 | 11 | * The function MUST be detached from the timeout using detach() method. |
co838_gtvl2 | 6:6c61186c8739 | 12 | * |
co838_gtvl2 | 6:6c61186c8739 | 13 | * You can check the usage in the main.cpp file at the end of the main() function. |
co838_gtvl2 | 6:6c61186c8739 | 14 | */ |
co838_gtvl2 | 6:6c61186c8739 | 15 | class MyTimeout : public Timeout |
co838_gtvl2 | 6:6c61186c8739 | 16 | { |
co838_gtvl2 | 6:6c61186c8739 | 17 | public: |
co838_gtvl2 | 6:6c61186c8739 | 18 | bool hasAttachment() |
co838_gtvl2 | 6:6c61186c8739 | 19 | { |
co838_gtvl2 | 6:6c61186c8739 | 20 | #if defined _DEBUG |
co838_gtvl2 | 6:6c61186c8739 | 21 | pc.printf("Has function ? %c\r\n", (this->_function != NULL ? 'Y' : 'N')); |
co838_gtvl2 | 6:6c61186c8739 | 22 | #endif |
co838_gtvl2 | 6:6c61186c8739 | 23 | return (this->_function != NULL); |
co838_gtvl2 | 6:6c61186c8739 | 24 | } |
co838_gtvl2 | 6:6c61186c8739 | 25 | }; |
co838_gtvl2 | 6:6c61186c8739 | 26 | |
co838_gtvl2 | 6:6c61186c8739 | 27 | #endif /* _MYTIMEOUT_HPP_ */ |