Core 2 ADC always min or max values
-
I have a Core 2 and the M5GO BOTTOM2.
Attached to port B on the battery is a circuit that outputs a voltage between 0-3.3v. The output of the circuit is attached to GPIO 36. When plugged in, adc.read() always returns 4095, and when unplugged reads 0. It should be reading 1.5v (measured with multimeter). Any ideas what could be going wrong?
from m5stack import * from m5stack_ui import * from uiflow import * import machine import time screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) v = None label0 = M5Label('label0', x=77, y=74, color=0x000, font=FONT_MONT_14, parent=None) adc0 = machine.ADC(36) adc0.atten(machine.ADC.ATTN_0DB) adc0.width(machine.ADC.WIDTH_12BIT) while True: v = adc0.read() label0.set_text(str(v)) wait_ms(5)
-
@jkeyser
never mind, changing gain fixed itadc0.atten(machine.ADC.ATTN_11DB)