Closed andrfgs closed 3 years ago
Closed.
I realize this is an old issue but I was doing some clean up for the upcoming v1.3 release and resolved this issue. I found a number of minor improvements to optimize and found the native serial port monitoring thread that was causing the blocking issue. This should be working now in v1.3-SNAPSHOT.
The pi4j library is extremely unstable when using serial communication. Everything seems to crash everything.
I'm using pi4j core 1.2 and a Raspberry Pi Zero W (I purchased it a month ago, so I assume it's the most recent model).
This prints the ASCII string returned by the device connected to the serial (an Arduino, to be specific). Then it prints "Finished" and hangs.
If I take out the
serial.close();
the program simply crashes with exceptionI can also use the event listener functions, the same happens. If possible, I'd rather use this on the Main thread, the arduino only sends information after it receives anything from the raspberry pi, so there's no risk of the buffer keep growing.
Right now, what works is not closing or shutting down the wiring pi. But this sucks because it will cause problems if I rerun the program.