Temperature display on LCD 16X2 using LM35
Fork of 1_On_board_LED_with_lib by
main.cpp
- Committer:
- Lakshmikumar
- Date:
- 2014-11-12
- Revision:
- 1:bc0c3c69d797
- Parent:
- 0:58d7f2487d66
File content as of revision 1:bc0c3c69d797:
#include "mbed.h" #include "TextLCD.h" int i; AnalogIn LM35(p15);///////////LM35 TextLCD lcd(p26,p25,p24,p23,p22,p21);//rs,e,d0-d3 int main() { while(1) { float tempC,a[11],avg; avg=0; for(i=10; i!=0; i--) { a[i]=LM35.read(); } for(i=10; i!=0; i--) { avg=avg+(a[i]/10); } tempC=(avg*3.18155037*100);//////equation for calculating temp in °C lcd.cls(); lcd.locate(0,0); lcd.printf("Temp %.2f'C",tempC); wait(1); } }