It's a 2nd generation rpi, so I've changed all instances of busnum to 1 for all files.
As it's using the MCP23017-E/SP IC, I've also increased the num_gpios = 16 in the Adafruit_MCP230xx.py, and set the busnum = 1
mcp = Adafruit_MCP230XX(address = 0x20, num_gpios = 16, busnum = 1)
Troubleshooting:
- The buttons appear to work as expected:
If I use the button test script from here: viewtopic.php?f=50&t=36800 I can see that the buttons are working as expected.
- The i2cdetect can find the device @ the correct address:
# sudo i2cdetect -y 1
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- Adjusting the contrast pot seems to have an effect on the faded boxes in the background. (Could be mistaken here)
- running LCDTest seems to hang, and when I hit control + C I get:
Traceback (most recent call last):
File "./LCDtest.py", line 55, in <module>
if (lcd.buttonPressed(lcd.RIGHT)):
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py", line 261, in buttonPressed
return not self.mcp.input(buttonname)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_MCP230xx.py", line 122, in input
value = self.i2c.readU16(MCP23017_GPIOA)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_I2C.py", line 107, in readU16
result = (hibyte <<
- Running Adafruit_CharLCDPlate.py has a similar output:
sudo python Adafruit_CharLCDPlate.py
^CTraceback (most recent call last):
File "Adafruit_CharLCDPlate.py", line 274, in <module>
if (lcd.buttonPressed(lcd.UP)):
File "Adafruit_CharLCDPlate.py", line 261, in buttonPressed
return not self.mcp.input(buttonname)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_MCP230xx.py", line 122, in input
value = self.i2c.readU16(MCP23017_GPIOA)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_CharLCDPlate/Adafruit_I2C.py", line 106, in readU16
hibyte = self.bus.read_byte_data(self.address, reg)
KeyboardInterrupt
When I run either of these scripts, I'm not sure if it's supposed to return to the command line, but it does not. Just kind of sits there, pushing the buttons on the LCD (All of them) Do nothing to return it to a command prompt.
Suggestions?




