Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion inventorhatmini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(self, address=IOE_ADDRESS, motor_gear_ratio=50, init_motors=True, i
""" Initialise inventor hat mini's hardware functions
"""
self.address = address
self.ioe = None

gpiodevice.friendly_errors = True

Expand Down Expand Up @@ -159,7 +160,8 @@ def reinit(self):
self.ioe.set_mode(self.IOE_CURRENT_SENSES[1], ADC)

def __del__(self):
self.ioe.reset()
if self.ioe is not None:
self.ioe.reset()

def switch_pressed(self):
return self._read_pin(self._pin_user_sw)
Expand Down
Loading