Open lily-mara opened 2 years ago
Hi @lily-mara, sorry for the delay!
Interesting! I think you're the first person to get esp32_hal
and rust-esp32-std-hello
to work nicely! I don't think @schphil had such luck in #64. It's odd that there is no relation to you touching it at all, it indicates to me that perhaps esp-idf is treading on the Rust drivers feet somwhere.
When I run the adc
example in this repo, I do see pin 33 reacting to my touches (I don't have a temp hooked up, but my finger will carry a small voltage), but compared to other pins like pin 25, it seems far less sensitive. Perhaps try another pin and see what results you get?
Oh I didn't realize that I was that much of a trailblazer 😄. Similar to schphil, I only went down this route due to missing functionality in esp-idf-hal
.
I checked every GPIO pin on the board, and none of them work with this example program I provided. I checked a few with the Arduino sketch and validated that they do work, but I didn't check every pin in this way.
Perhaps the real issue here is the missing functionality in esp-idf-hal
. I may have also simply not understood the docs. Should it be possible to take ADC readings with esp-idf-hal
today? I wasn't able to figure this out. I don't need any other functionality from this crate, so I would have my needs met if I could use the other hal crate.
I am trying to use several of the ESP crates together in a program, and I seem to be getting inconsistent results from the ADC when using this crate. I have created a minimum program to demonstrate the issue. This program reads the raw value from GPIO pin 33 and prints it to a newline on the serial interface. I wrote the same program in the Arduino IDE to validate that I do not have an issue with my hardware or circuit:
Arduino code
Rust code
Cargo.toml
build.rs
.cargo/config
src/main.rs
I have my ESP32 wired up to a temperature sensor, and expect the ADC to return values around 800. Here is a plot of the values returned from the arduino code, and we can see that the values match expectations.
I touched the temperature sensor partway through the monitoring, causing the increase shown on the graph.
Compare this with the graph coming from the Rust code, which shows no relationship to my touching or not touching the sensor. It is even often maxing out and not moving. I'm not sure what might be going on here.
I'm using the latest commit (0324fc1d43294b5b0450b8a31e382e38bf3bee4b) of the esp fork of the Rust compiler and building on an
aarch64-apple-darwin
machine. My board is a TTGO T-Display.