import qwiic_tca9548a
import time
import sys
import smbus2 


def runExample():

    bus = smbus2.SMBus(26)
    test = qwiic_tca9548a.QwiicTCA9548A(address=0x71, i2c_driver=bus)

    if test.is_connected() == False:
        print("The Qwiic TCA9548A device isn't connected to the system. Please check your connection", \
            file=sys.stderr)
        return

    print(test.is_connected())

    test.list_channels()
    time.sleep(2)

    test.enable_channels([4,5])
    test.list_channels()
    time.sleep(2)

    test.disable_channels(5)
    test.list_channels()
    time.sleep(2)


runExample()
