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.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "stdio.h" 00004 AnalogIn ain(PTC2); 00005 TextLCD lcd(PTA1,PTA2,PTD4,PTA12,PTA4,PTA5,TextLCD::LCD16x2); 00006 DigitalOut ground(PTC9); 00007 char buff[15]={'\0'}; 00008 00009 int main() 00010 { 00011 ground=0; 00012 lcd.cls(); 00013 while(1) 00014 { 00015 float temp[70]={0},volt[100]={0};//arrey for temp & vltg 00016 int i=0, j=0; 00017 00018 for(i=0;i<100;i++) 00019 { 00020 volt[i]=ain*3.3; 00021 } 00022 for(i=0;i<70;i++) 00023 { 00024 float avg = 0.0; //initialise avg 00025 00026 for(j=i;j<(i+20);j++) //taking first 20 reading 00027 { 00028 avg = avg +volt[j]; 00029 } 00030 avg = avg/20.0; //taking avg of 20 readings 00031 temp[i] = avg*100.0; // calibrating temp with 10mV / degree C 00032 } 00033 //initialization of lcd 00034 lcd.cls(); 00035 for(i=0;i<70;i++) 00036 { 00037 lcd.locate(0,0); 00038 lcd.printf("Vtg:"); 00039 lcd.locate(7,0); 00040 sprintf(buff,"%.2f",volt[i]); 00041 lcd.printf(buff); 00042 lcd.locate(0,1); 00043 lcd.printf("Temp:"); 00044 sprintf(buff,"%.2f",temp[i]); 00045 lcd.printf(buff); 00046 wait(0.5); 00047 } 00048 } 00049 }
Generated on Sun Nov 26 2023 17:36:04 by
1.7.2