Summary of "micropython analog inputs"

MicroPython analog inputs (Raspberry Pi Pico)

Key concepts

Raspberry Pi Pico specifics

Hardware example: potentiometer

MicroPython usage (quick guide)

from machine import Pin, ADC
import utime  # or: import time
adc = ADC(26)   # ADC0 / GP26
value = adc.read_u16()
from machine import Pin, ADC
import utime

adc = ADC(26)            # GP26 / ADC0
led = Pin(0, Pin.OUT)

while True:
    raw = adc.read_u16()                  # 0..65535
    volts = raw * 3.3 / 65535             # convert to volts
    print(raw, "{:.3f} V".format(volts))
    if raw > 35000:
        led.on()
    else:
        led.off()
    utime.sleep_ms(200)

Practical tips / gotchas

Source: hands-on MicroPython tutorial/demonstration (unnamed instructor) showing ADC use on the Raspberry Pi Pico.

Category ?

Technology


Share this summary


Is the summary off?

If you think the summary is inaccurate, you can reprocess it with the latest model.

Video