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
Timing issue with analog reads #16
Comments
The iterator thread updates the values of the pins, and has a little sleep time in there (https://github.com/tino/pyFirmata/blob/master/pyfirmata/util.py#L42). It is probably that that update has not run yet when you read the values. Could you try this instead of your reads and
That will probably tell you how long you have to wait. |
Hi Tino, Thanks! The first value is returned after around 22ms. If I try to fix it in util.py, by changing the little sleep time of 1ms to 50ms, I get:
That's obviously not the right place to wait. At least I can produce some working code now! Groetjes, Bram |
The easiest is probably to just read and test for |
I've done exactly that. But when reading digital ports at the same time, it gives me nothing but |
What do you mean by "reading digital ports at the same time"? This is the only example I could find quickly. It is not that easy though... |
Closing, as I can't move forward with this. Hopefully it's not a problem anymore! |
Hi,
I could not manage to setup a reliable connection between my pc and arduino (standard firmata sketch). The confusing part is that it all seems to work in the python command line, but when running the example code in a small script, analog reads return 'None'. After inserting a little pause (emulating manual execution in the python shell), analog read does output some values.
Here's my test-script:
...and it's output:
As mentioned, when just typing the statements in the python shell it just seems to work fine:
Used hard-/software:
pyFirmata 0.95 in python 2.7.3
Firmata 2.3.5 on an Arduino duemilanova (ATmega328 version)
Any clue?
Bests,
Bram
The text was updated successfully, but these errors were encountered: