Sandesh G / Mbed 2 deprecated TEMPLM35

Dependencies:   TextLCD mbed

Fork of 1_On_board_LED_with_lib by Harish Mekali

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 
00005 int i;
00006 
00007 AnalogIn LM35(p15);///////////LM35
00008 TextLCD lcd(p26,p25,p24,p23,p22,p21);//rs,e,d0-d3
00009 
00010 int main()
00011 {       while(1)
00012        {
00013         float tempC,a[11],avg;
00014         avg=0;
00015         for(i=10; i!=0; i--) 
00016         {
00017             a[i]=LM35.read();
00018         }
00019         for(i=10; i!=0; i--) 
00020         {
00021             avg=avg+(a[i]/10);
00022         }
00023         
00024         tempC=(avg*3.18155037*100);//////equation for calculating temp in °C
00025         lcd.cls();
00026         lcd.locate(0,0);
00027         lcd.printf("Temp %.2f'C",tempC);
00028         wait(1);
00029 
00030        
00031     }
00032 }