This library is designed to work with LCD screens on the I2C bus. This library is an import of arduino library LiquidCrystal_I2C. This library was tested on the Nucleo F103 debug card using the LCD module 1602A.
Dependents: mbed-os-example-mbed6-wifi_MY_SOCKET_rigtech_copy_
main.cpp@0:824096cc05af, 2017-05-19 (annotated)
- Committer:
- Yar
- Date:
- Fri May 19 18:21:24 2017 +0000
- Revision:
- 0:824096cc05af
Import arduino library for working with LCD screen. Checked work with the LCD display 1602A, with the control controller ks0066U.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yar | 0:824096cc05af | 1 | #include "mbed.h" |
Yar | 0:824096cc05af | 2 | #include <LiquidCrystal_I2C.h> |
Yar | 0:824096cc05af | 3 | |
Yar | 0:824096cc05af | 4 | // Set the LCD address to 0x27 for a 16 chars and 2 line display |
Yar | 0:824096cc05af | 5 | LiquidCrystal_I2C lcd(0x4E, 16, 2); |
Yar | 0:824096cc05af | 6 | |
Yar | 0:824096cc05af | 7 | |
Yar | 0:824096cc05af | 8 | |
Yar | 0:824096cc05af | 9 | int main() |
Yar | 0:824096cc05af | 10 | { |
Yar | 0:824096cc05af | 11 | |
Yar | 0:824096cc05af | 12 | // initialize the LCD |
Yar | 0:824096cc05af | 13 | lcd.begin(); |
Yar | 0:824096cc05af | 14 | |
Yar | 0:824096cc05af | 15 | // Turn on the blacklight and print a message. |
Yar | 0:824096cc05af | 16 | lcd.backlight(); |
Yar | 0:824096cc05af | 17 | lcd.print("Hello, world!"); |
Yar | 0:824096cc05af | 18 | |
Yar | 0:824096cc05af | 19 | while (1) { |
Yar | 0:824096cc05af | 20 | /* |
Yar | 0:824096cc05af | 21 | // Read temperature register |
Yar | 0:824096cc05af | 22 | data_write[0] = LM75_REG_TEMP; |
Yar | 0:824096cc05af | 23 | i2c.write(LM75_ADDR, data_write, 1, 1); // no stop |
Yar | 0:824096cc05af | 24 | i2c.stop(); |
Yar | 0:824096cc05af | 25 | wait(0.01); |
Yar | 0:824096cc05af | 26 | i2c.read(LM75_ADDR, data_read, 2, 0); |
Yar | 0:824096cc05af | 27 | i2c.stop(); |
Yar | 0:824096cc05af | 28 | */ |
Yar | 0:824096cc05af | 29 | wait(0.01); |
Yar | 0:824096cc05af | 30 | } |
Yar | 0:824096cc05af | 31 | |
Yar | 0:824096cc05af | 32 | } |
Yar | 0:824096cc05af | 33 |