Skip to content

menu.py example program having trouble on i2c RPI-UI #6

@mrumpler

Description

@mrumpler

Hi,

I just found this great piece of software when searching for usable libraries to use in my PI-project. I own two RPi-UI boards both with i2c as interface.

I changed the code in menu.py to reflect my i2c board like that:

bus = I2C( 1 )
lcd = RPi_Ui_20x4(bus)
lcd.SetPinConfig(1,MCP9700)
lcd.ExtTemp=lcd.Pins[1]
lcd.Contrast(128)
lcd.Backlight(128)
lcd.Cls()

the rest is original.
When i start the demo program the UI screen gets blanked, the differently set contrast and backlight as well as the Cls() works, but when the program tries to show the main menu this happens:

pi@raspbmc:~/bw_library-master/examples$ sudo ./menu.py
Traceback (most recent call last):
File "./menu.py", line 168, in
menu.Show()
File "/usr/local/lib/python2.7/dist-packages/BitWizard/ui.py", line 99, in Show
self.MenuLoop()
File "/usr/local/lib/python2.7/dist-packages/BitWizard/ui.py", line 135, in MenuLoop
self.Buttons.ReportPressed() #flush register
File "/usr/local/lib/python2.7/dist-packages/BitWizard/bw.py", line 725, in ReportPressed
v =self.Bus.Read_uInt8(self.Address,0x30)
File "/usr/local/lib/python2.7/dist-packages/BitWizard/bw.py", line 162, in Read_uInt8
return struct.unpack('B',self.Transaction(chr(Address+1)+chr(Register),3)[1][2])[0]
IndexError: string index out of range

Any ideas what happens?
The screen shows Characters that in pieces look like the wanted menu but there are also unwanted characters on the screen.

Any ideas?
Thanks for your help
Mike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions