I am due to receive a single relay switch (COM-15093) soon and put togethera simple test program to check access as shown here:
“”"
Test case: Qwiic connected single-relay switch (COM-15093)
“”"
import qwiic
get the list of attached I2C devices
devs = qwiic.list_devices()
print(devs)
if len(devs) > 0:
locate relay switch
relays = [x for x in devs if x[1].upper().find(‘RELAY’) >= 0]
if len(relays) > 0:
recognize relay switch
RelaySwitch = qwiic.create_device(relays[0][0])
if RelaySwich is not None:
print(RelaySwich)
else:
print(“****** RELAY SWITCH CANNOT BE RECOGNIZED ******”)
else:
print(“****** NO RELAYS FOUND ******”)
else:
print(“****** NO DEVICES ATTACHED ******”)
However, past qwiic.create_device, I do not see any clear documentation to, say, turn the relay on and off. Any example code on relay switch activation will be useful.