This is sample program for lpclcd. http://strawberry-linux.com/catalog/items?code=12014 lpclcd USBマイコン内蔵I2C液晶モジュール(16x2行)
Dependencies: I2cLCD USBDevice mbed
main.cpp@0:11aedf11fda0, 2013-11-03 (annotated)
- Committer:
- xshige
- Date:
- Sun Nov 03 14:24:35 2013 +0000
- Revision:
- 0:11aedf11fda0
this is sample program for lpclcd.; http://strawberry-linux.com/catalog/items?code=12014; lpclcd USB??????I2C???????(16x2?);
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xshige | 0:11aedf11fda0 | 1 | // lpclcd LCD test program |
xshige | 0:11aedf11fda0 | 2 | // 2013/11/3 |
xshige | 0:11aedf11fda0 | 3 | |
xshige | 0:11aedf11fda0 | 4 | #include "mbed.h" |
xshige | 0:11aedf11fda0 | 5 | #include "I2cLCD.h" |
xshige | 0:11aedf11fda0 | 6 | #include "USBSerial.h" |
xshige | 0:11aedf11fda0 | 7 | |
xshige | 0:11aedf11fda0 | 8 | //Virtual serial port over USB |
xshige | 0:11aedf11fda0 | 9 | USBSerial serial; |
xshige | 0:11aedf11fda0 | 10 | // I2C LCD pin assignment |
xshige | 0:11aedf11fda0 | 11 | I2cLCD lcd(p28, p27, p29); //sda scl reset |
xshige | 0:11aedf11fda0 | 12 | |
xshige | 0:11aedf11fda0 | 13 | DigitalOut myled(P1_6); |
xshige | 0:11aedf11fda0 | 14 | DigitalOut backlight(P1_3); |
xshige | 0:11aedf11fda0 | 15 | DigitalIn usersw(P0_1); |
xshige | 0:11aedf11fda0 | 16 | |
xshige | 0:11aedf11fda0 | 17 | long cn; |
xshige | 0:11aedf11fda0 | 18 | |
xshige | 0:11aedf11fda0 | 19 | int main() { |
xshige | 0:11aedf11fda0 | 20 | |
xshige | 0:11aedf11fda0 | 21 | backlight = 0; |
xshige | 0:11aedf11fda0 | 22 | lcd.cls(); |
xshige | 0:11aedf11fda0 | 23 | lcd.printf("mbed lpclcd test"); |
xshige | 0:11aedf11fda0 | 24 | lcd.locate(0,1); |
xshige | 0:11aedf11fda0 | 25 | lcd.printf("LPC11U24"); |
xshige | 0:11aedf11fda0 | 26 | |
xshige | 0:11aedf11fda0 | 27 | cn = 0; |
xshige | 0:11aedf11fda0 | 28 | while(1) { |
xshige | 0:11aedf11fda0 | 29 | if (usersw == 1) { |
xshige | 0:11aedf11fda0 | 30 | lcd.locate(0,1); |
xshige | 0:11aedf11fda0 | 31 | lcd.printf("LPC11U24 %7d",cn++); |
xshige | 0:11aedf11fda0 | 32 | } else { |
xshige | 0:11aedf11fda0 | 33 | lcd.locate(0,1); |
xshige | 0:11aedf11fda0 | 34 | lcd.printf("lpc11u24 %7d",cn++); |
xshige | 0:11aedf11fda0 | 35 | }; |
xshige | 0:11aedf11fda0 | 36 | serial.printf("Virtual Serial Port: LPC11U24 %7d\r\n",cn); |
xshige | 0:11aedf11fda0 | 37 | myled = 1; |
xshige | 0:11aedf11fda0 | 38 | wait(0.2); |
xshige | 0:11aedf11fda0 | 39 | myled = 0; |
xshige | 0:11aedf11fda0 | 40 | wait(0.2); |
xshige | 0:11aedf11fda0 | 41 | } |
xshige | 0:11aedf11fda0 | 42 | } |