-
Notifications
You must be signed in to change notification settings - Fork 26
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
Multiple Arduinos #10
Comments
I think you are the 1st who tried it with two Arduinos. As you say it should work as they are totally separate in their instances. I can only guess that the previous maintainer has introduced a global variable somewhere. |
If that is the case, I'd have to potentially search for and edit out some kind of global variable in the pyfirmata2.py code itself? |
It would be nice to find the bug and send me a pull request. :) |
I don't have the longest experience with Python. I'll be looking more into how these are handled, but if you have any ideas if those may be defaulting to the "last called board" that would be great to know. |
Okay, by moving each board into its own function and calling them one at a time, I've isolated the fault to be either due to the enable_reporting(), or register_callback() functions. Note my comments on those lines -- that describes the behavior when only one of those are disabled at a time. I'm honestly baffled why this is happening, so any help would be greatly appreciated!
|
I am working with multiple ArduinoMega units. I've gotten this code to work extremely well when only 1 single Arduino is hooked up, but as soon as I hook up 2 or more, the input functions (related to the register callback, enable reporting, etc) default to the last defined Arduino board.
I have written an extremely simplified version of what I'm seeing:
What I am seeing -- adjusting the pin (acting as a button) on board 1 will print "Button 2..." and likewise, adjust the pin on board 2 will print "Button 2..."
If I swap the order of the board definitions, board2 following by board, then the opposite happens, and only "Button 1..." will print.
Is there a core function I'm missing to allow multiple, simultaneous serial communications with multiple Arduino boards?
The text was updated successfully, but these errors were encountered: