LcdDisplay
LcdDisplay
allows you to control a Liquid-crystal display (LCD) like Hitachi HD44780 from Elixir.
Here is the documentation and example apps for this library.
For more info on the display, please refer to Hitachi HD44780 datasheet.
Installation
You can install LcdDisplay
by adding lcd_display
to your list of dependencies in mix.exs
:
def deps do
[
{:lcd_display, "0.0.14"}
]
end
Usage
As an example, if you want to control a Hitachi HD44780 type display through
I2C, you can use LcdDisplay.HD44780.I2C
module as a
display driver.
Detectconnected devices
Before connecting to an I2C device, please detect connected devices.
iex> Circuits.I2C.detect_devices()
Circuits.I2C.detect_devices
Devices on I2C bus "i2c-1":
* 64 (0x40)
* 112 (0x70)
2 devices detected on 1 I2C buses
Start an LCD driver and get a PID.
driver_module = LcdDisplay.HD44780.I2C
driver_config = %{
display_name: "display 1", # the identifier
i2c_bus: "i2c-1", # I2C bus name
i2c_address: 0x27, # 7-bit address
rows: 2, # the number of display rows
cols: 16, # the number of display columns
font_size: "5x8" # "5x10" or "5x8"
}
pid = LcdDisplay.start_display(driver_module, driver_config)
Run commands
Please refer to the LcdDisplay.Driver
documentation for supported display commands.
LcdDisplay.execute(pid, {:print, "Hello world"})
LcdDisplay.execute(pid, :clear)
Thanks
ExLCD
for inspiration