Quote:
Originally Posted by edcasati
I am trying to get an Arduino to communicate with a Raspberry Pi through a USB cable.
|
That's an ambiguous description. USB is a bus that supports many different type of devices.
Presumably the RPi is the USB host, and the Arduino is the USB device.
The simplest way of describing the USB connection is identifying the device node that you use on the USB host.
On the RPi you are probably accessing
/dev/ttyACM0, which is a serial terminal that uses a USB CDC ACM device.
Quote:
Originally Posted by edcasati
So my question is, if I send data to a Linux box via the serial port, how can it be processed so that it is treated as a terminal command and gets processed so that it triggers the script?
|
Hardware is useless without (proper) software.
Putty and
screen are terminal emulator programs that allow a human to send and receive text with the connected/remote device. They are not programs that allow a remote device to access the Linux host without human interaction.
There are two basic approaches:
1. A login terminal
The device
/dev/ttyACM0 can be setup as a terminal so that the connected device (the Arduino) can log into the Linux host (by providing a username and password that
getty or
agetty would process), and then have access using a shell.
The burden is on the connected device (the Arduino) to be Linux-aware by sending valid shell commands, and be able to deal with
all possible results.
This type of connection by a non-human "user" (even when terminal echo is suppressed) is atypical.
2. A dedicated application
You write/build and execute an application program that opens
/dev/ttyACM0, and then "forever" reads and proceseses the input sent by the Arduino.
This is the conventional/traditional configuration for connecting industrial/comercial devices using a proprietary communication protocol.
You can devise any level of complexity for exchanging information between the two devices.
Regards