Hisyam Sulaiman
/
ADC
cg
Diff: main.cpp
- Revision:
- 0:a060af406e72
- Child:
- 1:877582fb6b65
diff -r 000000000000 -r a060af406e72 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 17 06:51:12 2018 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(D8, D9, D4, D5, D6, D7); +Serial pc(USBTX, USBRX); +AnalogIn Ain(PC_3); +float ADCdata; + + +int main() { + while(1) { + ADCdata=Ain; + ADCdata=ADCdata*100; + lcd.locate (4,1); + lcd.printf("%f",ADCdata); + pc.printf("%f\n\r",ADCdata); + wait(0.5); + } +}