Extended TextLCD: uses Bus or Port output for added performance, with display/cursor control, with LCDType as a class, with character generator programming capability.
main.cpp@1:c360c4648b08, 2011-02-05 (annotated)
- Committer:
- osmeest
- Date:
- Sat Feb 05 22:07:11 2011 +0000
- Revision:
- 1:c360c4648b08
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
osmeest | 1:c360c4648b08 | 1 | // Hello World! for the TextLCD |
osmeest | 1:c360c4648b08 | 2 | |
osmeest | 1:c360c4648b08 | 3 | #include "ext_text_lcd/TextLCD.h" |
osmeest | 1:c360c4648b08 | 4 | #include <sstream> |
osmeest | 1:c360c4648b08 | 5 | #include <iostream> |
osmeest | 1:c360c4648b08 | 6 | #include <iomanip> |
osmeest | 1:c360c4648b08 | 7 | |
osmeest | 1:c360c4648b08 | 8 | using namespace std; |
osmeest | 1:c360c4648b08 | 9 | using namespace ext_text_lcd; |
osmeest | 1:c360c4648b08 | 10 | |
osmeest | 1:c360c4648b08 | 11 | //TextLCD lcd(p28, p27, p26, p25, p24, p23, TextLCD::LCD20x2); // rs, e, d4-d7 |
osmeest | 1:c360c4648b08 | 12 | TextLCD lcd(p28, p27, Port2, 0, TextLCD::LCD20x2); // rs, e, d4-d7 |
osmeest | 1:c360c4648b08 | 13 | |
osmeest | 1:c360c4648b08 | 14 | int main() { |
osmeest | 1:c360c4648b08 | 15 | lcd.setDisplayControl(TextLCD::DisplayOn, TextLCD::CursorOn, TextLCD::BlinkingCursor); |
osmeest | 1:c360c4648b08 | 16 | |
osmeest | 1:c360c4648b08 | 17 | lcd.locate(0,0); |
osmeest | 1:c360c4648b08 | 18 | lcd.printf("(0,0)"); |
osmeest | 1:c360c4648b08 | 19 | lcd.locate(0,1); |
osmeest | 1:c360c4648b08 | 20 | lcd.printf("(0,1)"); |
osmeest | 1:c360c4648b08 | 21 | lcd.locate(14,0); |
osmeest | 1:c360c4648b08 | 22 | lcd.printf("(19,0)"); |
osmeest | 1:c360c4648b08 | 23 | lcd.locate(14,1); |
osmeest | 1:c360c4648b08 | 24 | lcd.printf("(19,1)"); |
osmeest | 1:c360c4648b08 | 25 | |
osmeest | 1:c360c4648b08 | 26 | while (1) { |
osmeest | 1:c360c4648b08 | 27 | lcd.locate(0,0); |
osmeest | 1:c360c4648b08 | 28 | wait(2); |
osmeest | 1:c360c4648b08 | 29 | lcd.locate(0,1); |
osmeest | 1:c360c4648b08 | 30 | wait(2); |
osmeest | 1:c360c4648b08 | 31 | lcd.locate(19,0); |
osmeest | 1:c360c4648b08 | 32 | wait(2); |
osmeest | 1:c360c4648b08 | 33 | lcd.locate(19,1); |
osmeest | 1:c360c4648b08 | 34 | wait(2); |
osmeest | 1:c360c4648b08 | 35 | } |
osmeest | 1:c360c4648b08 | 36 | } |