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
Diff: ThermalDisplayer.cpp
- Revision:
- 1:06713d1b69cf
- Child:
- 2:5d0c209e5c61
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ThermalDisplayer.cpp Tue Feb 09 21:41:48 2016 +0000 @@ -0,0 +1,24 @@ +#include "ThermalDisplayer.h" + +ThermalDisplayer::ThermalDisplayer() { + this->lcd = new C12832(D11, D13, D12, D7, D10); + this->pot = new AnalogIn(A1); + this->temperatures = std::list<float>(MAX_SIZE); +} + +void ThermalDisplayer::addTemp(const float &temp) { + this->temperatures.pop_front(); + this->temperatures.push_back(temp); +} + +void ThermalDisplayer::display() { + list<float>::const_iterator it; + + this->lcd->cls(); + int pos = 0; + for (it = this->temperatures.begin(); it != this->temperatures.end(); it++, pos++) { + float tmp = *it; + + this->lcd->rect(pos * 2, 32, pos * 2 + 1, 32 - (int) (tmp * 32.0 / 50.0), 1); + } +} \ No newline at end of file