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