Eduvance Remolab
/
Analog_LDR_and_LCD
This lab shows how to interface and analog input with a traditional 16x2 LCD
main.cpp@0:e95cb494c628, 2016-02-05 (annotated)
- Committer:
- EduRemo
- Date:
- Fri Feb 05 07:26:37 2016 +0000
- Revision:
- 0:e95cb494c628
FRCRCE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EduRemo | 0:e95cb494c628 | 1 | #include "mbed.h" |
EduRemo | 0:e95cb494c628 | 2 | #include "TextLCD.h" |
EduRemo | 0:e95cb494c628 | 3 | |
EduRemo | 0:e95cb494c628 | 4 | |
EduRemo | 0:e95cb494c628 | 5 | TextLCD lcd(PTC9, PTC8, PTA5, PTA4, PTA12, PTD4, TextLCD::LCD16x2); // rs, e, d4-d7 |
EduRemo | 0:e95cb494c628 | 6 | AnalogIn ain(PTC2); |
EduRemo | 0:e95cb494c628 | 7 | |
EduRemo | 0:e95cb494c628 | 8 | int main(void){ |
EduRemo | 0:e95cb494c628 | 9 | while(1){ |
EduRemo | 0:e95cb494c628 | 10 | lcd.cls(); |
EduRemo | 0:e95cb494c628 | 11 | lcd.locate(0,0); |
EduRemo | 0:e95cb494c628 | 12 | lcd.printf("Winter is coming"); |
EduRemo | 0:e95cb494c628 | 13 | lcd.locate(0,1); |
EduRemo | 0:e95cb494c628 | 14 | lcd.printf("value is %.2f",ain.read()); |
EduRemo | 0:e95cb494c628 | 15 | wait(1); |
EduRemo | 0:e95cb494c628 | 16 | }} |