I am using PlatformIO for programming and Arduino Mega and an Arduino Uno. I have them hooked up through serial, so I have to disconnect them from each other every time I want to program them. I also unplug them from the computer so that I don't accidentally fry them while moving wires around.
Every time I plug one or the other back in and try to program it immediately, I get this error message:
*** [upload] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'
If I wait for about a minute and try again, then the code will be uploaded no problem. What could be causing this?