Akash Verma
/
analog_potentiometer
analog data of trim pot, read and display
Diff: pot.cpp
- Revision:
- 0:9fed7af3234d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pot.cpp Wed Feb 12 11:13:39 2020 +0000 @@ -0,0 +1,25 @@ +#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 + } +}