Simple program to drive an I2C character display.
Dependencies: Skool_wkshp_lib2015 mbed
Skool_display.cpp@0:2e362289ef7e, 2015-10-02 (annotated)
- Committer:
- lvagasi
- Date:
- Fri Oct 02 21:45:38 2015 +0000
- Revision:
- 0:2e362289ef7e
Simple program to drive an I2C character LCD. Working.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lvagasi | 0:2e362289ef7e | 1 | #include "mbed.h" |
lvagasi | 0:2e362289ef7e | 2 | #include "serial_lcd.h" |
lvagasi | 0:2e362289ef7e | 3 | #include "pc_uart.h" |
lvagasi | 0:2e362289ef7e | 4 | |
lvagasi | 0:2e362289ef7e | 5 | extern Serial pc; // UART to communicate with PC |
lvagasi | 0:2e362289ef7e | 6 | DigitalOut GLED(PB_5); |
lvagasi | 0:2e362289ef7e | 7 | |
lvagasi | 0:2e362289ef7e | 8 | int main() { |
lvagasi | 0:2e362289ef7e | 9 | |
lvagasi | 0:2e362289ef7e | 10 | GLED = 1; |
lvagasi | 0:2e362289ef7e | 11 | |
lvagasi | 0:2e362289ef7e | 12 | init_ser_lcd(); |
lvagasi | 0:2e362289ef7e | 13 | write_ser_lcd(0x80, false); // set DDRAM addr to 0x00 |
lvagasi | 0:2e362289ef7e | 14 | write_ser_text((char *)"ARM SKOOL",16); |
lvagasi | 0:2e362289ef7e | 15 | write_ser_lcd(0xC0, false); // set DDRAM addr to 0x40, beginning of 2nd line |
lvagasi | 0:2e362289ef7e | 16 | write_ser_text((char *)" Kijelzo teszt ", 16); |
lvagasi | 0:2e362289ef7e | 17 | |
lvagasi | 0:2e362289ef7e | 18 | wait(3.0); |
lvagasi | 0:2e362289ef7e | 19 | |
lvagasi | 0:2e362289ef7e | 20 | while (1) { |
lvagasi | 0:2e362289ef7e | 21 | GLED = !GLED; |
lvagasi | 0:2e362289ef7e | 22 | wait(1.0); |
lvagasi | 0:2e362289ef7e | 23 | } |
lvagasi | 0:2e362289ef7e | 24 | } |