Hisyam Sulaiman / Mbed 2 deprecated ptnom3

Dependencies:   TextLCD mbed

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 TextLCD lcd(D8, D9, D4, D5, D6, D7);
00005 DigitalIn button(PA_12);
00006 Serial pc(USBTX, USBRX);
00007 AnalogIn Ain(PC_3);
00008 float ADCdata;
00009 
00010 int main() {
00011     
00012 lcd.locate (1,0);   
00013 lcd.printf("Celsius");
00014 
00015         
00016     while(1) {
00017         if (button==0){
00018         ADCdata=Ain;
00019         ADCdata=ADCdata*100;
00020         lcd.locate (4,1);
00021         lcd.printf("%f",ADCdata);
00022         pc.printf("%f\n\r",ADCdata);
00023         wait(0.5);}
00024         else  (button==1){
00025         ADCdata=Ain;
00026         ADCdata=ADCdata*100;
00027         lcd.locate (12,1);
00028         lcd.printf("%f",ADCdata);
00029         pc.printf("%f\n\r",ADCdata);
00030         wait(0.5);}
00031     }
00032 }