analog data of trim pot, read and display

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pot.cpp Source File

pot.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 //FVP for lcd. rs,en,d4-d7, type of lcd
00005 TextLCD lcd(PTA1, PTA2, PTD4, PTA12, PTA4, PTA5, TextLCD::LCD16x2);
00006 
00007 // Serial pc(USBTX, USBRX);
00008 AnalogIn Ain(PTB0);
00009 float ADCdata;
00010 int main()
00011 {
00012     while (1) {
00013         ADCdata=Ain*1023;
00014         pc.printf("ADC Data Values... \n\r");
00015         pc.printf("%.2f \n\r",ADCdata);
00016         wait (0.5);
00017 
00018         lcd.locate(1,0);    //col,row
00019         lcd.printf("analoge value");
00020         lcd.locate(2,1);    //col,row
00021         lcd.printf("%.2f \n\r",ADCdata);
00022         wait(0.5);
00023         lcd.cls();  //clear lcd
00024     }
00025 }