Eduvance Remolab
/
Analog_LDR_and_LCD
This lab shows how to interface and analog input with a traditional 16x2 LCD
Diff: main.cpp
- Revision:
- 0:e95cb494c628
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 05 07:26:37 2016 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "TextLCD.h" + + +TextLCD lcd(PTC9, PTC8, PTA5, PTA4, PTA12, PTD4, TextLCD::LCD16x2); // rs, e, d4-d7 +AnalogIn ain(PTC2); + +int main(void){ + while(1){ + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Winter is coming"); + lcd.locate(0,1); + lcd.printf("value is %.2f",ain.read()); + wait(1); + }}