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

Committer:
co838_gtvl2
Date:
Tue Feb 09 21:41:48 2016 +0000
Revision:
1:06713d1b69cf
Child:
2:5d0c209e5c61
Cool LCD Graphic with historic of temperature (64 cycles)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
co838_gtvl2 1:06713d1b69cf 1 #include "ThermalDisplayer.h"
co838_gtvl2 1:06713d1b69cf 2
co838_gtvl2 1:06713d1b69cf 3 ThermalDisplayer::ThermalDisplayer() {
co838_gtvl2 1:06713d1b69cf 4 this->lcd = new C12832(D11, D13, D12, D7, D10);
co838_gtvl2 1:06713d1b69cf 5 this->pot = new AnalogIn(A1);
co838_gtvl2 1:06713d1b69cf 6 this->temperatures = std::list<float>(MAX_SIZE);
co838_gtvl2 1:06713d1b69cf 7 }
co838_gtvl2 1:06713d1b69cf 8
co838_gtvl2 1:06713d1b69cf 9 void ThermalDisplayer::addTemp(const float &temp) {
co838_gtvl2 1:06713d1b69cf 10 this->temperatures.pop_front();
co838_gtvl2 1:06713d1b69cf 11 this->temperatures.push_back(temp);
co838_gtvl2 1:06713d1b69cf 12 }
co838_gtvl2 1:06713d1b69cf 13
co838_gtvl2 1:06713d1b69cf 14 void ThermalDisplayer::display() {
co838_gtvl2 1:06713d1b69cf 15 list<float>::const_iterator it;
co838_gtvl2 1:06713d1b69cf 16
co838_gtvl2 1:06713d1b69cf 17 this->lcd->cls();
co838_gtvl2 1:06713d1b69cf 18 int pos = 0;
co838_gtvl2 1:06713d1b69cf 19 for (it = this->temperatures.begin(); it != this->temperatures.end(); it++, pos++) {
co838_gtvl2 1:06713d1b69cf 20 float tmp = *it;
co838_gtvl2 1:06713d1b69cf 21
co838_gtvl2 1:06713d1b69cf 22 this->lcd->rect(pos * 2, 32, pos * 2 + 1, 32 - (int) (tmp * 32.0 / 50.0), 1);
co838_gtvl2 1:06713d1b69cf 23 }
co838_gtvl2 1:06713d1b69cf 24 }