-
Notifications
You must be signed in to change notification settings - Fork 50
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
How do I read/write analog values #14
Comments
It is definitely within the scope of this library, but nobody has gotten around to it yet. We haven't written an abstraction layer for it, but it should be possible to do on a chip-dependent manner by manually reading the IO registers (https://docs.rs/ruduino/0.1.2/ruduino/cores/atmega328/index.html) like you would in C/C++ to perform the operation. Otherwise, a new trait can be written for IO registers implementing analog IO inside the (
It is probably possible to do this using embedded-hal, perhaps the folks on #13 have an example. |
Thanks for the response. I was able to rewrite analogRead() and init() from arduino to Rust so that's success. I will try to port over more functionality from the arduino libraries to rust and build a usable platform as I think it will be great for developers familiar with the Arduino toolkit and want to code on Rust. If anything I produce is useful for ruduino or other projects I will try to chime in. I don't think my Rust knowledge is still good enough to contribute to this project directly butI am interested on expanding the functionalities of ruduino. |
@dylanmckay for those interested this is what I came up with.
|
I don't seem to find a way to read analog input using this library. I suppose that it is either not currently supported or considered too high level for this library.
Is there an example on to achieve this (read and possibly write analog values) using Rust?
The text was updated successfully, but these errors were encountered: