-
Notifications
You must be signed in to change notification settings - Fork 31
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
Support for analog reading of pins. #42
Comments
Sorry about this but I just found the issue from 2017 referencing this (this one), it was marked as next update some time in October of last year. Just checking now if there is any update upon this, you mentioned in that post that the |
Yes, sorry about that, I got busy with other projects! You are right, there is currently no digital or analog read/write support, and it is on the list. The reason why it is not currently present, is that I wrote bitio as a way to publish projects in my Minecraft coding book for kids, and time was short, so I only implemented the bits I needed at the time for the book to be published. The various important parts are implemented in
To add an analog read, for resistor values, we would need an A half way house for this, to get you going, might be to just modify the I think the new method on
If you wanted an analog on other pins, inside This is a 'get you going' hack that would work for analog read. There is a whole piece of work to do with pins in particular, as different pins support different modes, some support touch, some do not, some support analog, some do not. The model of pins needs re-architecting to support different overlapping pin features, to do this properly, but that is a bigger bit of work. Hope this helps to get your project working for you though! |
Likewise, if you are only using pins 0,1,2, a hack for other modes could be to add these methods to
The precise MicroPython/micro:bit APIs for pins are documented here: https://microbit-micropython.readthedocs.io/en/v1.0.1/pin.html |
Thanks |
If someone wanted to try this, as well as adding the other pins, even though it is a hack, it would work, and I would accept it as a PR. Looking at @musabkilic here, in case he is interested in making this change and testing it! |
I was just wondering (as from what I can see it does not appear to currently be supported) whether a function that returns the current voltage of a pin, for things like variable resistors to be used as inputs. I only ask as I am trying to use a variable resistor in my current project and can only find the rather limited
is_touched()
function that only returns a true or false value. Thanks for any response to this request in advance.The text was updated successfully, but these errors were encountered: