Adafruit_Learning_System_Gu.../ADG72x_Examples/CircuitPython_ADG728/code.py
Liz e2b43f353e add BNO055 and BMP280 BFF examples
adding circuitpython and arduino examples for BNO055 BMP280 BFF. also updating adg728 example to flip between two channels
2024-04-17 16:20:11 -04:00

26 lines
604 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
channels = [0, 4]
clock = time.monotonic()
while True:
if (time.monotonic() - clock) > switch_time:
print(f"Selecting channel {channels[c] + 1}")
switch.channel = channels[c]
c = (c + 1) % 2
clock = time.monotonic()
print((analog_in.value,))
time.sleep(0.1)