send character to shell script

Hi all, I have a bash shell script, which listens for character key presses, and does various things like take photos, create streams, and push files to a server. That all works fine. Unfortunately I cannot deploy a keyboard in my project due to certain constraints. E.g: it is being used by children.

So, I want to have the arduino send characters to the computer to a listening shell script. But, I'm not sure how to make a shell script listen to the arduino. I see that there is a serial port, and that the device is /dev/acm0 But i am not sure how to read data comming in from the arduino.

can someone give me an example or tutorial of how to pass characters to a shell script with arduino?

There is no "pass chars to a xxxxx". The arduino writes to it Serial port and the what ever at the other end reads the serial/comms port. The arduino does not know what (if anything) will be reading the data it sends nor does it care. Its the same with sending data to the arduino it does not care what is sending the data or where it came from.

Mark

Did you try..

cat /dev/acm0

use a pipe?

I did not try cat, as it would read and close. When i did try it for giggles right now, nothing was read. I did try "read" which never prints any values.

I have the code:

void setup()
{
  // start serial port at 9600 bps and wait for port to open:
  Serial.begin(9600);
}
void loop()
{
//here is A, in a practical application, it would be a varaible
    Serial.println("A");        
  delay(1000);
}

which outputs to the virtual terminal in the arduino software. I want the output to go to a shell script.

which outputs to the virtual terminal in the arduino software.

So, the serial data IS getting to the PC.

I want the output to go to a shell script.

So, make the shell script read the serial port. That is NOT an Arduino issue.

cat /dev/acm0 | script