Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd LM75B mbed
main.cpp
- Committer:
- ranafde
- Date:
- 2015-02-28
- Revision:
- 0:229e08a49858
File content as of revision 0:229e08a49858:
#include "mbed.h"
#include "LM75B.h"
#include "C12832_lcd.h"
#include <string>
C12832_LCD lcd;
LM75B sensor(p28,p27);
Serial pc(USBTX,USBRX);
string s[2] = {"hi", "lo"};
float prevTemp, curTemp;
string display;
int count = 1;
int main ()
{
prevTemp = sensor.read();
curTemp = prevTemp;
display = s[1];
while (1) {
curTemp = sensor.read();
lcd.cls();
lcd.locate(0,5);
lcd.printf("Temp = %.3f\n", sensor.read());
lcd.locate(0,15);
if((curTemp - prevTemp) > 2 || (prevTemp - curTemp > 2)){
count++;
display = s[count % 2];
prevTemp = curTemp;
}
lcd.printf("%s",display);
wait(1.0);
}
}