2

(Using Raspberry Pi 3B, Raspbian Jessie)

I have a Python script that uses an Arduino with Pyserial.

I want to start this script on boot, but my problem is that sometimes the Arduino binds to /dev/ttyACM0, and sometimes to /dev/ttyACM1.

If it binds to the one that's not specified in the script, the script fails.

Is there a way to force one or the other? And if not, is there a way I can switch from one to the other in the script?

scruss
  • 9,117
  • 1
  • 25
  • 36
hoothoot
  • 41
  • 1
  • 2

1 Answers1

2

What I would do is get your script to run the OS command ls /dev | ttyACM and redirect the output to a variable you will use in your script. That way, your script won't care where the Arduino connects.

tlhIngan
  • 3,372
  • 5
  • 21
  • 33