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
00001 #include "mbed.h" 00002 #include "LM75B.h" 00003 #include "C12832_lcd.h" 00004 #include <string> 00005 00006 C12832_LCD lcd; 00007 00008 LM75B sensor(p28,p27); 00009 Serial pc(USBTX,USBRX); 00010 00011 string s[2] = {"hi", "lo"}; 00012 float prevTemp, curTemp; 00013 string display; 00014 int count = 1; 00015 00016 int main () 00017 { 00018 prevTemp = sensor.read(); 00019 curTemp = prevTemp; 00020 display = s[1]; 00021 while (1) { 00022 curTemp = sensor.read(); 00023 lcd.cls(); 00024 lcd.locate(0,5); 00025 lcd.printf("Temp = %.3f\n", sensor.read()); 00026 lcd.locate(0,15); 00027 if((curTemp - prevTemp) > 2 || (prevTemp - curTemp > 2)){ 00028 count++; 00029 display = s[count % 2]; 00030 prevTemp = curTemp; 00031 } 00032 lcd.printf("%s",display); 00033 wait(1.0); 00034 } 00035 00036 }
Generated on Mon Aug 8 2022 05:48:14 by
1.7.2