2

So my project is using to Arduinos slaves to RPI that is master. They communicate through USB. Each time I remove one of the Arduinos I need to modify the .Py script to add the new USB alocated. Is there any way to keep same USB in program even after removing and plug in one of the Arduinos?

arduino1 = serial.Serial("/dev/ttyUSB1", 9600)
arduino2 = serial.Serial("/dev/ttyUSB2", 9600)

So if I remove USB1 after I put it back will be something like USB 3.

3
  • 1
    Does it also get a new name when you connect it to the exactly same USB port as before?
    – PMF
    Nov 5, 2019 at 11:35
  • 1
    Yes each time is different. So I need to give unique id's
    – Andy Andy
    Nov 5, 2019 at 19:08
  • Hi @Andy Andy, Ah, let me see. Ref 3 of my answer to this question might help: raspberrypi.stackexchange.com/questions/105280/…. Cheers.
    – tlfong01
    Nov 9, 2019 at 4:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.