Akash Verma
/
analog_potentiometer
analog data of trim pot, read and display
pot.cpp@0:9fed7af3234d, 2020-02-12 (annotated)
- Committer:
- rdverma
- Date:
- Wed Feb 12 11:13:39 2020 +0000
- Revision:
- 0:9fed7af3234d
for FRDM-KL25Z ARM Mbed Board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rdverma | 0:9fed7af3234d | 1 | #include "mbed.h" |
rdverma | 0:9fed7af3234d | 2 | #include "TextLCD.h" |
rdverma | 0:9fed7af3234d | 3 | |
rdverma | 0:9fed7af3234d | 4 | //FVP for lcd. rs,en,d4-d7, type of lcd |
rdverma | 0:9fed7af3234d | 5 | TextLCD lcd(PTA1, PTA2, PTD4, PTA12, PTA4, PTA5, TextLCD::LCD16x2); |
rdverma | 0:9fed7af3234d | 6 | |
rdverma | 0:9fed7af3234d | 7 | // Serial pc(USBTX, USBRX); |
rdverma | 0:9fed7af3234d | 8 | AnalogIn Ain(PTB0); |
rdverma | 0:9fed7af3234d | 9 | float ADCdata; |
rdverma | 0:9fed7af3234d | 10 | int main() |
rdverma | 0:9fed7af3234d | 11 | { |
rdverma | 0:9fed7af3234d | 12 | while (1) { |
rdverma | 0:9fed7af3234d | 13 | ADCdata=Ain*1023; |
rdverma | 0:9fed7af3234d | 14 | pc.printf("ADC Data Values... \n\r"); |
rdverma | 0:9fed7af3234d | 15 | pc.printf("%.2f \n\r",ADCdata); |
rdverma | 0:9fed7af3234d | 16 | wait (0.5); |
rdverma | 0:9fed7af3234d | 17 | |
rdverma | 0:9fed7af3234d | 18 | lcd.locate(1,0); //col,row |
rdverma | 0:9fed7af3234d | 19 | lcd.printf("analoge value"); |
rdverma | 0:9fed7af3234d | 20 | lcd.locate(2,1); //col,row |
rdverma | 0:9fed7af3234d | 21 | lcd.printf("%.2f \n\r",ADCdata); |
rdverma | 0:9fed7af3234d | 22 | wait(0.5); |
rdverma | 0:9fed7af3234d | 23 | lcd.cls(); //clear lcd |
rdverma | 0:9fed7af3234d | 24 | } |
rdverma | 0:9fed7af3234d | 25 | } |