How to program multiple Teensy's in platformIO simultaneously on Ubuntu?
The issue here is that Teensy's constantly change what kind of device they are, so sometimes after programming them, either the Serial Monitor won't open, requiring them to be unplugged and replugged in.
This cause more issues, as it's possible they reconnect in a different order, so platformIO may flash to the wrong board based on undefined conditions.
How can I program them in a way that leaves no guesswork, and also consistently access the Serial Monitor?
Below info aggregated from this thread: PJRC forum
Install tycmd command from instructions here: tytools
figure out which boards you have with
tycmd list
returns:
add 9665090-Teensy Teensy 3.6 (USB Serial)
add 10253260-Teensy Teensy 3.6 (USB Serial)
Where those numbers are serial numbers.
in platformio.ini, add
upload_command = tycmd upload -B $UPLOAD_PORT $SOURCE
upload_port = 9665090-Teensy
where upload port is the one from above you want to program to. $SOURCE is defined by platformIO.
To get the serial monitor for one of them, type
tycmd reset -B 10253260 #reset if it won't open
tycmd monitor -B 10253260
The inbuilt platformIO serial monitor will no longer be used, but the above command will open a different Serial Monitor program which is better because you can reliable specify which Teensy to use.