Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4# Simple demo to read analog input on channel 0
5
6import time
7import board
8import adafruit_ads7830.ads7830 as ADC
9from adafruit_ads7830.analog_in import AnalogIn
10
11i2c = board.I2C()
12
13# Initialize ADS7830
14adc = ADC.ADS7830(i2c)
15chan = AnalogIn(adc, 0)
16
17while True:
18 print(f"ADC channel 0 = {chan.value}")
19 time.sleep(0.1)