Hisyam Sulaiman
/
ADC
cg
main.cpp@0:a060af406e72, 2018-05-17 (annotated)
- Committer:
- HisyamSulaiman
- Date:
- Thu May 17 06:51:12 2018 +0000
- Revision:
- 0:a060af406e72
- Child:
- 1:877582fb6b65
try
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HisyamSulaiman | 0:a060af406e72 | 1 | #include "mbed.h" |
HisyamSulaiman | 0:a060af406e72 | 2 | #include "TextLCD.h" |
HisyamSulaiman | 0:a060af406e72 | 3 | |
HisyamSulaiman | 0:a060af406e72 | 4 | TextLCD lcd(D8, D9, D4, D5, D6, D7); |
HisyamSulaiman | 0:a060af406e72 | 5 | Serial pc(USBTX, USBRX); |
HisyamSulaiman | 0:a060af406e72 | 6 | AnalogIn Ain(PC_3); |
HisyamSulaiman | 0:a060af406e72 | 7 | float ADCdata; |
HisyamSulaiman | 0:a060af406e72 | 8 | |
HisyamSulaiman | 0:a060af406e72 | 9 | |
HisyamSulaiman | 0:a060af406e72 | 10 | int main() { |
HisyamSulaiman | 0:a060af406e72 | 11 | while(1) { |
HisyamSulaiman | 0:a060af406e72 | 12 | ADCdata=Ain; |
HisyamSulaiman | 0:a060af406e72 | 13 | ADCdata=ADCdata*100; |
HisyamSulaiman | 0:a060af406e72 | 14 | lcd.locate (4,1); |
HisyamSulaiman | 0:a060af406e72 | 15 | lcd.printf("%f",ADCdata); |
HisyamSulaiman | 0:a060af406e72 | 16 | pc.printf("%f\n\r",ADCdata); |
HisyamSulaiman | 0:a060af406e72 | 17 | wait(0.5); |
HisyamSulaiman | 0:a060af406e72 | 18 | } |
HisyamSulaiman | 0:a060af406e72 | 19 | } |