adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
438 stars 328 forks source link

ODROID-COMMON: Support ADC pins #765

Closed how2flow closed 6 months ago

how2flow commented 6 months ago

e.g.

import time
import board
from analogio import AnalogIn

analog_in = AnalogIn(board.A0) # support A0 and A1.

def get_voltage(pin):
    return (pin.value * 1.8) / 1024

while True:
    print((get_voltage(analog_in),))
    time.sleep(0.1)
makermelissa commented 6 months ago

Please run pre-commit to reformat the files and then commit and push the reformatting.