I have program that has 6 threads. Each thread calls to the self.board = pyfirmata.ArduinoMega(megaPort). However, only one thread can continue running as the other threads have issues opening the port again. I would like to know is there a way to open the Arduino port again in the other 5 threads? I am using PyFirmata and PySerial.
Only one application will be able to open the serial port; in your situation, each thread can be considered an application. Or in other words, a serial port can only be opened once till such time that it's closed.
You can share your serial port object between the threads. Each thread can check if the port is open and open it if that's not the case.
Note that I'm not a python person.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.