Variable names changed, code doesn't run
2630 Views - Created 05/10/2015
01/08/2015
Posted by:
allanwright
In the file ABE_ExpanderPi.py, in the class IO, there are a number of variables such as :
__ioaddress = 0x20 # I2C address
__portA_dir = 0x00 # port a direction
__portB_dir = 0x00 # port b direction
__portA_val = 0x00 # port a value
__portB_val = 0x00 # port b value
__portA_pullup = 0x00 # port a pull-up resistors
__portB_pullup = 0x00 # port a pull-up resistors
__portA_polarity = 0x00 # input polarity for port a
__portB_polarity = 0x00 # input polarity for port b
__intA = 0x00 # interrupt control for port a
__intB = 0x00 # interrupt control for port a
In some of the functions, such as set_pin_direction() and set_pin_pullup(), different variable names are used such as:
port_a_dir instead of __portA_dir,
address instead of __ioaddress,
port_a_pullup instead of __portA_pullup, etc.
As a result, these functions fail.
__ioaddress = 0x20 # I2C address
__portA_dir = 0x00 # port a direction
__portB_dir = 0x00 # port b direction
__portA_val = 0x00 # port a value
__portB_val = 0x00 # port b value
__portA_pullup = 0x00 # port a pull-up resistors
__portB_pullup = 0x00 # port a pull-up resistors
__portA_polarity = 0x00 # input polarity for port a
__portB_polarity = 0x00 # input polarity for port b
__intA = 0x00 # interrupt control for port a
__intB = 0x00 # interrupt control for port a
In some of the functions, such as set_pin_direction() and set_pin_pullup(), different variable names are used such as:
port_a_dir instead of __portA_dir,
address instead of __ioaddress,
port_a_pullup instead of __portA_pullup, etc.
As a result, these functions fail.
Thank you for spotting the problem with the variable names. I have uploaded a new version of the library to GitHub; which should have all of the variable names fixed.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.