analog data of trim pot, read and display

Dependencies:   mbed TextLCD

pot.cpp

Committer:
rdverma
Date:
2020-02-12
Revision:
0:9fed7af3234d

File content as of revision 0:9fed7af3234d:

#include "mbed.h"
#include "TextLCD.h"

//FVP for lcd. rs,en,d4-d7, type of lcd
TextLCD lcd(PTA1, PTA2, PTD4, PTA12, PTA4, PTA5, TextLCD::LCD16x2);

// Serial pc(USBTX, USBRX);
AnalogIn Ain(PTB0);
float ADCdata;
int main()
{
    while (1) {
        ADCdata=Ain*1023;
        pc.printf("ADC Data Values... \n\r");
        pc.printf("%.2f \n\r",ADCdata);
        wait (0.5);

        lcd.locate(1,0);    //col,row
        lcd.printf("analoge value");
        lcd.locate(2,1);    //col,row
        lcd.printf("%.2f \n\r",ADCdata);
        wait(0.5);
        lcd.cls();  //clear lcd
    }
}