http://uk.farnell.com/batron/bthq21605v-cog-fsre-i2c/lcd-module-alphanumeric-2x16/dp/1220409
Dependents: PCF2119_16X2_LCD_test LPC1768BagSensor
main.cpp@0:581d2def0734, 2011-05-13 (annotated)
- Committer:
- ssozonoff
- Date:
- Fri May 13 13:25:10 2011 +0000
- Revision:
- 0:581d2def0734
Basic driver for the Batron 16x2 Alphanumeric I2C LCD display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ssozonoff | 0:581d2def0734 | 1 | #include "mbed.h" |
ssozonoff | 0:581d2def0734 | 2 | #include "PC2119_16X2_LCD.h" |
ssozonoff | 0:581d2def0734 | 3 | #include "TMP102.h" |
ssozonoff | 0:581d2def0734 | 4 | |
ssozonoff | 0:581d2def0734 | 5 | TMP102 temperature(p28, p27, 0x90); |
ssozonoff | 0:581d2def0734 | 6 | |
ssozonoff | 0:581d2def0734 | 7 | DigitalOut myled(LED1); |
ssozonoff | 0:581d2def0734 | 8 | PC2119_16X2_LCD lcd(p28, p27, p21); |
ssozonoff | 0:581d2def0734 | 9 | |
ssozonoff | 0:581d2def0734 | 10 | int main() { |
ssozonoff | 0:581d2def0734 | 11 | char str[5]; |
ssozonoff | 0:581d2def0734 | 12 | |
ssozonoff | 0:581d2def0734 | 13 | lcd.Init(); |
ssozonoff | 0:581d2def0734 | 14 | lcd.clear_display(); |
ssozonoff | 0:581d2def0734 | 15 | |
ssozonoff | 0:581d2def0734 | 16 | // spin it 180 |
ssozonoff | 0:581d2def0734 | 17 | lcd.flip_display(); |
ssozonoff | 0:581d2def0734 | 18 | |
ssozonoff | 0:581d2def0734 | 19 | while (1) { |
ssozonoff | 0:581d2def0734 | 20 | lcd.printf("%2.2fC", temperature.read()); |
ssozonoff | 0:581d2def0734 | 21 | |
ssozonoff | 0:581d2def0734 | 22 | lcd.write_xy(0x21, 1, 15, true); |
ssozonoff | 0:581d2def0734 | 23 | myled = 1; |
ssozonoff | 0:581d2def0734 | 24 | wait(0.5); |
ssozonoff | 0:581d2def0734 | 25 | myled = 0; |
ssozonoff | 0:581d2def0734 | 26 | lcd.write_xy(0x11, 1, 15, true); |
ssozonoff | 0:581d2def0734 | 27 | wait(0.5); |
ssozonoff | 0:581d2def0734 | 28 | } |
ssozonoff | 0:581d2def0734 | 29 | } |