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)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login