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.
temp.cpp
00001 #include "mbed.h" 00002 #include"TextLCD.h" 00003 00004 AnalogIn LM35(p15); 00005 TextLCD lcd(p21,p22,p23,p24,p25,p26); 00006 00007 int main() 00008 { 00009 float tempC, tempF, a[10],avg; 00010 int i; 00011 while(1) 00012 { 00013 avg=0; 00014 for(i=0;i<10;i++) 00015 { 00016 a[i] = LM35.read(); 00017 wait(0.2); 00018 { 00019 avg=(avg+a[i]/10); 00020 } 00021 00022 tempC = ((LM35*3.3)-0.600)*100.0; 00023 tempF = (9.0*tempC)/(5.0 + 32.0); 00024 lcd.locate(0,0); 00025 lcd.printf("temperature"); 00026 lcd.locate(0,1); 00027 lcd.printf("%.2fC%.2fF",tempC,tempF); 00028 wait(0.5); 00029 } 00030 } 00031 } 00032
Generated on Tue Apr 18 2023 11:32:06 by
1.7.2