code.py
1 # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 # CircuitPython AnalogIn Demo 6 7 import time 8 9 import board 10 from analogio import AnalogIn 11 12 analog_in = AnalogIn(board.A1) 13 14 15 def get_voltage(pin): 16 return (pin.value * 3.3) / 65536 17 18 19 while True: 20 print((get_voltage(analog_in),)) 21 time.sleep(0.1)