]> Repositories - Adafruit_Blinka-hackapet.git/blob - examples/analog_in.py
Ran pre-commit
[Adafruit_Blinka-hackapet.git] / examples / analog_in.py
1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
2 #
3 # SPDX-License-Identifier: MIT
4 """Analog in demo"""
5 import time
6 import board
7 from analogio import AnalogIn
8
9 analog_in = AnalogIn(board.A1)
10
11
12 def get_voltage(pin):
13     return (pin.value * 3.3) / 4096
14
15
16 while True:
17     print((get_voltage(analog_in),))
18     time.sleep(0.1)