Add support for LCD Keypad Kits
caternuson opened this issue · comments
Add support for these products:
https://www.adafruit.com/category/808
The old lib had this:
https://github.com/adafruit/Adafruit_Python_CharLCD/blob/master/Adafruit_CharLCD/Adafruit_CharLCD.py#L430
oh yahh! @kattni i forgot about the buttons - wanna do this up? can return the digitalIO pins upon request
i think we can pre-define the digitalIO's in the RGB I2C LCD object, and set them to input_pullup's, then you can acces them from like lcd.up_button.value
or whatnot
sgondor from the forums made some code that worked for him. It is given below:
import adafruit_mcp230xx as mcp_
import digitalio
#Create the push buttons
up = mcp.get_pin(3)
down = mcp.get_pin(2)
left = mcp.get_pin(4)
right = mcp.get_pin(1)
select = mcp.get_pin(0)
#Define buttons as inputs
up.direction = digitalio.Direction.INPUT
down.direction = digitalio.Direction.INPUT
left.direction = digitalio.Direction.INPUT
right.direction = digitalio.Direction.INPUT
select.direction = digitalio.Direction.INPUT
#Create pull-ups for each button
up.pull = digitalio.Pull.UP
down.pull = digitalio.Pull.UP
left.pull = digitalio.Pull.UP
right.pull = digitalio.Pull.UP
select.pull = digitalio.Pull.UP
#And then to read the status of a button just use:
up.value
down.value
left.value
right.value
select.value
yep that will work just fine, we'd like to have that all done for you in the library - we'll get to it shortly, lots of people traveling this week :)
Hi, is there any update on this? I've been waiting to get my shield buttons working.
oh yeah, this slipped over the holidays - @kattni wanna do this now?
Sure thing! I'll get started on it.
This is now included!