Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4476

Python • PI Pico Vsys measurement

$
0
0
Measurement of Vsys using AC3 seems to stop working after setting the internal LED high

Here is the python code:
import machine
import utime

adcpin = machine.Pin(29, machine.Pin.IN) # ensure ADC3 pin is input
vsys = machine.ADC(3) # measures Vsvs
led_onboard = machine.Pin("LED", machine.Pin.OUT)
print("vsys",vsys.read_u16()*3.23*3/65535)

while True :
print("vsys1",vsys.read_u16()*3.23*3/65535)
utime.sleep(2.0)
led_onboard.low()
print("vsys2",vsys.read_u16()*3.23*3/65535)
utime.sleep(2.0)
led_onboard.high()
print("vsys3",vsys.read_u16()*3.23*3/65535)
utime.sleep(2.0)

And here are the results :
MPY: soft reboot
vsys 4.753844
vsys1 4.751478
vsys2 4.763308
vsys3 0.03785214
vsys1 0.03785214

Any idea why driving the internal LED high :o should cause this to return bad readings?
Thanks
KiloHertz

Statistics: Posted by KiloHertz — Fri Mar 01, 2024 9:16 pm — Replies 0 — Views 20



Viewing all articles
Browse latest Browse all 4476

Trending Articles