We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm trying to read VSYS voltage using Raspberry Pi Pico's ADC using steps described here: https://forums.raspberrypi.com/viewtopic.php?t=301152
However, reading it from PIN_29 using ADC gives incorrect values. It should be around 4 volts, yet the ADC measured ~0.15 volts.
PIN_29
Is this a bug in embassy's ADC implementation? The sample code I used is below:
#![no_std] #![no_main] use defmt::*; use embassy_executor::Spawner; use embassy_rp::{gpio, pwm, uart, adc}; use embassy_time::Duration; use {defmt_rtt as _, panic_probe as _}; embassy_rp::bind_interrupts!(struct Irqs { ADC_IRQ_FIFO => adc::InterruptHandler; }); fn to_voltage(raw_voltage: u16) -> f32 { let mut ret = raw_voltage as f32; ret *= 3.23; ret *= 3.0; ret /= 65535.0; ret } #[embassy_executor::main] async fn main(spawner: Spawner) { let p = embassy_rp::init(Default::default()); let mut adc_0 = adc::Adc::new(p.ADC, Irqs, adc::Config::default()); let mut p_voltage = adc::Channel::new_pin(p.PIN_29, gpio::Pull::None); let voltage = adc_0.read(&mut p_voltage).await.unwrap(); let voltage = to_voltage(voltage); info!("input voltage: {}", voltage); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I'm trying to read VSYS voltage using Raspberry Pi Pico's ADC using steps described here:
https://forums.raspberrypi.com/viewtopic.php?t=301152
However, reading it from
PIN_29
using ADC gives incorrect values.It should be around 4 volts, yet the ADC measured ~0.15 volts.
Is this a bug in embassy's ADC implementation?
The sample code I used is below:
The text was updated successfully, but these errors were encountered: