Simple test¶
Ensure your device works with this simple test.
examples/sparkfun_qwiicquadsolidstaterelay_simpletest.py¶
1""" QuadRelayTest """
2# QuadRelayTest: Copyright (c) 2022 Graham Beland
3#
4# SPDX-License-Identifier: MIT
5# import the CircuitPython board and busio libraries
6# CircuitPython board
7import board
8
9# the sparkfun_qwiicquadsolidstaterelay
10import sparkfun_qwiicquadsolidstaterelay
11
12# Create bus object using the board's I2C port
13i2c = board.I2C()
14
15# Note: default i2c address is 8
16theRelay = sparkfun_qwiicquadsolidstaterelay.Sparkfun_QwiicQuadSolidStateRelay(i2c)
17print("Opened: Relay Controller")
18if theRelay.connected:
19 print("Relay connected. ")
20 theRelay.relay_on(1)
21 theRelay.relay_off(1)
22else:
23 print("Relay does not appear to be connected. Please check wiring.")