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.
Diff: main.cpp
- Revision:
- 0:1e4bca77e18e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Jun 15 08:37:39 2015 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "stdio.h"
+AnalogIn ain(PTC2);
+TextLCD lcd(PTA1,PTA2,PTD4,PTA12,PTA4,PTA5,TextLCD::LCD16x2);
+DigitalOut ground(PTC9);
+char buff[15]={'\0'};
+
+int main()
+{
+ ground=0;
+ lcd.cls();
+ while(1)
+ {
+ float temp[70]={0},volt[100]={0};//arrey for temp & vltg
+ int i=0, j=0;
+
+ for(i=0;i<100;i++)
+ {
+ volt[i]=ain*3.3;
+ }
+ for(i=0;i<70;i++)
+ {
+ float avg = 0.0; //initialise avg
+
+ for(j=i;j<(i+20);j++) //taking first 20 reading
+ {
+ avg = avg +volt[j];
+ }
+ avg = avg/20.0; //taking avg of 20 readings
+ temp[i] = avg*100.0; // calibrating temp with 10mV / degree C
+ }
+ //initialization of lcd
+ lcd.cls();
+ for(i=0;i<70;i++)
+ {
+ lcd.locate(0,0);
+ lcd.printf("Vtg:");
+ lcd.locate(7,0);
+ sprintf(buff,"%.2f",volt[i]);
+ lcd.printf(buff);
+ lcd.locate(0,1);
+ lcd.printf("Temp:");
+ sprintf(buff,"%.2f",temp[i]);
+ lcd.printf(buff);
+ wait(0.5);
+ }
+ }
+}
\ No newline at end of file