21 lines
354 B
Python
21 lines
354 B
Python
# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# CircuitPython AnalogIn Demo
|
|
|
|
import time
|
|
|
|
import board
|
|
from analogio import AnalogIn
|
|
|
|
analog_in = AnalogIn(board.A1)
|
|
|
|
|
|
def get_voltage(pin):
|
|
return (pin.value * 3.3) / 65536
|
|
|
|
|
|
while True:
|
|
print((get_voltage(analog_in),))
|
|
time.sleep(0.1)
|