Skip to content

Commit 87fa5c0

Browse files
committed
Added address parameter
1 parent 6f978d2 commit 87fa5c0

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

library/inventorhatmini/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ class InventorHATMini():
8686

8787
SHUNT_RESISTOR = 0.47
8888

89-
def __init__(self, motor_gear_ratio=50, init_motors=True, init_servos=True, init_leds=True, start_muted=False):
89+
def __init__(self, address=IOE_ADDRESS, motor_gear_ratio=50, init_motors=True, init_servos=True, init_leds=True, start_muted=False):
9090
""" Initialise inventor hat mini's hardware functions
9191
"""
92+
self.address = address
9293

9394
GPIO.setwarnings(False)
9495
GPIO.setmode(GPIO.BCM)
@@ -115,7 +116,7 @@ def __init__(self, motor_gear_ratio=50, init_motors=True, init_servos=True, init
115116

116117
def reinit(self):
117118
try:
118-
self.__ioe = SuperIOE(i2c_addr=self.IOE_ADDRESS, perform_reset=True)
119+
self.__ioe = SuperIOE(i2c_addr=self.address, perform_reset=True)
119120
except TimeoutError:
120121
raise TimeoutError(NO_IOE_MSG) from None
121122
except OSError:

0 commit comments

Comments
 (0)