Adafruit_Learning_System_Gu.../ADG72x_Examples/CircuitPython_ADG728/code.py
Liz 5325095d51 adding ADG729 examples
adding ADG729 examples for Arduino and CircuitPython
2024-04-15 17:45:24 -04:00

25 lines
566 B
Python

# SPDX-FileCopyrightText: Copyright (c) 2024 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_adg72x
from analogio import AnalogIn
analog_in = AnalogIn(board.A0)
i2c = board.I2C()
switch = adafruit_adg72x.ADG72x(i2c)
c = 0
switch_time = 2
clock = time.monotonic()
while True:
if (time.monotonic() - clock) > switch_time:
print(f"Selecting channel {c + 1}")
switch.channel = c
c = (c + 1) % 8
clock = time.monotonic()
print((analog_in.value,))
time.sleep(0.1)