PySerial sucks...

I never expected this to slow me down.

I need to turn some electronic device on when Panda starts and turn it off when the Panda app is closed (does not send feedback to Arduino).

I use PySerial and Arduino+ relay to do that.
For some reason PySerial’s serial.write() function works fine in the command line, but not when executing a py file.
I’m not the first to notice, but no real fix for this yet exists.
stackoverflow.com/questions/4235 … standalone
stackoverflow.com/questions/2931 … -in-script
stackoverflow.com/questions/2301 … -py-script

Doing time.sleep(2) in a Panda program is a terrible idea even if the only “solution” mentioned.
You guys are pretty bright. Any suggestions what to use or how to do it? It doesn’t even have to use PySerial.

it’s the hardware, not pyserial, that causes the problem.
if sleeping 2 sec is not acceptable in a Panda3D app, can you delay the read/write operations by 60 frames (assuming framerate in Panda is 30fps) ? so that the app keeps running, but Serial would think the app slept for 2 sec. :smiling_imp: