code.py
 1  # SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
 2  # SPDX-License-Identifier: MIT
 3  """CircuitPython Analog In Voltage Example for ESP32-S3"""
 4  import time
 5  import board
 6  import analogio
 7  
 8  analog_pin = analogio.AnalogIn(board.A0)
 9  
10  
11  def get_voltage(pin):
12      return (pin.value * 3.09) / 61285
13  
14  
15  while True:
16      print(get_voltage(analog_pin))
17      time.sleep(0.1)