jeanparpaillon / erlang_pi_lcd

Adafruit 16x2 LCD for Rasperry Pi using MCP23017. Erlang portdriver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adafruit Blue&White 16x2 LCD+Keypad Kit for Raspberry Pi

Erlang/OTP Application for the 16x2 LCD with MCP23017 on Raspberry Pi.

This is a port of the Python source code to Erlang.

At this time, the code and plate can control the white backlight on or off. There is no support for PWM control of the backlight at this time, so if you need to have more granular control of the backlight, this plate can't do that (the I2C expander does not have PWM output).

For more information on the product, prices and distributors, visit the Adafruit product page.

I got mine from Kjell and Company

LCD display

Build and test

lcd_app uses rebar3 as build tool.

Compile

rebar3 compile

Test

rebar3 shell

Example

pi@rpi02:~/adafruit_lcd $ rebar3 shell
===> Verifying dependencies...
===> Compiling lcd_app
make: Entering directory '/home/pi/adafruit_lcd/c_src'
cc -o ../priv/i2c_drv.so -fpic -shared -Wall -Wformat i2c_drv.c
make: Leaving directory '/home/pi/adafruit_lcd/c_src'
Erlang/OTP 18 [erts-7.3] [source] [smp:4:4] [async-threads:0] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> ===> The rebar3 shell is a development tool; to deploy applications in production, consider using releases (http://www.rebar3.org/v3.0/docs/releases)
===> Booted lcd_app

1> lcd:message("HELLO!").
ok
2>

Example create_char

pi@rpi02:~/adafruit_lcd $ rebar3 shell
===> Verifying dependencies...
===> Compiling lcd_app
make: Entering directory '/home/pi/adafruit_lcd/c_src'
cc -o ../priv/i2c_drv.so -fpic -shared -Wall -Wformat i2c_drv.c
make: Leaving directory '/home/pi/adafruit_lcd/c_src'
Erlang/OTP 18 [erts-7.3] [source] [smp:4:4] [async-threads:0] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> ===> The rebar3 shell is a development tool; to deploy applications in production, consider using releases (http://www.rebar3.org/v3.0/docs/releases)
===> Booted lcd_app
lcd:create_char(1, {2, 3, 2, 2, 14, 30, 12, 0}).
ok
2> lcd:clear().
ok
3> lcd:message([1]).
ok
4>

lcd methods

  • clear/0,
  • enable_display/1,
  • show_cursor/1,
  • message/1,
  • home/0,
  • set_cursor/2,
  • blink/1,
  • move_left/0,
  • move_right/0,
  • autoscroll/1
  • backlight/1
  • create_char/2

TODO

  • Button support
  • set_left_to_right
  • set_right_to_left

About

Adafruit 16x2 LCD for Rasperry Pi using MCP23017. Erlang portdriver.


Languages

Language:Erlang 74.4%Language:C 25.1%Language:Makefile 0.5%