You are not logged in.
Is it possible to connect more than 1 Arduino (trough USB) with de Rexcore/raspberry?
Offline
Yes it is but some extra care is necessary. If you just plug the 2 Arduinos in and reboot, you never know which one of them is /dev/ttyACM0 and which one is /dev/ttyACM1 (or /dev/ttyUSB*, see the other topic on identifying your Arduino).
So let's get this sorted out. First plug in only one Arduino and type
ls /dev/ttyACM*
You should get /dev/ttyACM0. Use it in the following command.
Then run this command
udevadm info -a -n /dev/ttyACM0 | less | grep KERNELS
You will get something like:
KERNELS=="1-1.2:1.0"
KERNELS=="1-1.2"
KERNELS=="1-1"
KERNELS=="usb1"
KERNELS=="20980000.usb"
KERNELS=="soc"
KERNELS=="platform"
Write down the identifier from the first line ("1-1.2:1.0"). This identifies the USB port in your system.
Repeat the above with the Arduino connected to another USB port(s) and find the USB port identifiers. I have "1-1.2:1.0" and "1-1.3:1.0".
Now create a file named /etc/udev/rules.d/99-arduino.rules, e.g.
sudo nano /etc/udev/rules.d/99-arduino.rules
Put the following in:
SUBSYSTEM=="tty", KERNEL=="ttyACM*", KERNELS=="1-1.2:1.0", SYMLINK+="arduino_one"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", KERNELS=="1-1.3:1.0", SYMLINK+="arduino_two"
Add more lines if you plan to use more than two Arduinos. Save and exit.
This means that whenever a ttyACM* device is plugged into the USB port "1-1.2:1.0", a symbolic device /dev/arduino_one is created. And that whenever a ttyACM* device is plugged into the USB port "1-1.3:1.0", a symbolic device /dev/arduino_two is created.
Now disconnect your Arduino and run
sudo /etc/init.d/udev reload
Afterwards connect your Arduinos to the appropriate USB ports and you should be able to use /dev/arduino_one and /dev/arduino_two in the REXduino function blocks. Unless you mismatch the USB ports, you'll always know which Arduino you are referring to.
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline