Skip to content
New issue

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

Is there example how to read two analog pins from one adc_driver (ADC1)? #502

Closed
chrshnv opened this issue Dec 18, 2024 · 1 comment
Closed

Comments

@chrshnv
Copy link

chrshnv commented Dec 18, 2024

No description provided.

@ivmarkov
Copy link
Collaborator

ivmarkov commented Dec 18, 2024

If you mean "oneshot" reading, then copy-pasting this line from the example should be more than sufficient (note that ADC-capable (= RTC) pin numbers are specific to each chip type).

I.e.

let mut adc_pin1 = AdcChannelDriver::new(&adc, peripherals.pins.gpio12, &config)?;
let mut adc_pin2 = AdcChannelDriver::new(&adc, peripherals.pins.gpio13, &config)?;

and then:

let reading1 = adc.read(&mut adc_pin1)?
let reading2 = adc.read(&mut adc_pin2)?

BTW, for such questions, it would be much more productive if you just ask in the Matrix chat linked in the README.md of the project.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants