Bash comm. with arduino uno over ttyACMx

Hi,

I stuck with my work and dont know what to do. Maybe somebody can give me some help.I am trying to get a LED on over a bash command line on linux.
There allready a few post in forum but didnt work for me.

When i enter echo "1" > /dev/ttyACM0 in cmd line i see the communication leds on the board flicker and also the LED on Output 13 flickers, (3 or 4 times) but dont stay on like in code written.
If i send 12345678987654321 > /dev/ttyACM0 it is the same result. On my arduino is no ftdi chip. Is that the reason it doesnt work?

code:

void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
}

void loop()
{
if (Serial.available() > 0)
{
int incoming = Serial.read();

if ((char)incoming == '1')
{
digitalWrite(13, HIGH);
Serial.println("On");
}
else if ((char)incoming == '2')
{
digitalWrite(13, LOW);
Serial.println("Off");
}
}
}

thanks

portspeed ?

stty -F /dev/ttyACM0 9600

does it work with screen ?

screen /dev/ttyACM0

Hi,

Portspeed is set to 9600. I have connected the Arduino to a dreambox(linux TV receiver) and so i dont have screen available.

is the arduino resetting on your connection?

Have you tried sending data from the arduino to your box first?
vary the data sent so you can verify it's not resetting on each connection.
/opt/bin/head -n2 /dev/ttyUSB0

the -n2 will return two lines

if you don't have screen - what about picocom?

picocom -r -b 9600 /dev/ttyUSB0
the -r is a noreset switch on exit

picocom is also not available on dreambox. i connected Arduino with ubuntu and it worked:

andi@andi-netbook:/dev$ picocom -r -b 9600 /dev/ttyACM0
picocom v1.4

port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
escape is : C-a
noinit is : no
noreset is : yes
nolock is : no
send_cmd is : ascii_xfr -s -v -l10
receive_cmd is : rz -vv

Terminal ready
On
Off
Off
On
Off
Off

And i also get the messages correctly back, On, Off. Thats exactly that what i would need for the linux receiver.

i found a screen package for dreambox
when i enter screen -e '1' > /dev/ttyACM0

i get exactly the same result. The led flicker a few times and thats it.

and found a picocom package for the box.
with picocom -b 9600 /dev/ttyACM0 i can set the led correctly! -great!!!!

how can i kill the terminal ?Once i have open picocom i cant stop?

Any idea because it dosnt work the usual way with echo?
thanks

to kill pico have to use the ctrl but I've not figured out actual what it wants - so I do ctrl-a, ctrl-x, ctrl-c until it stops - some times toss a shift in too!

did you try with the head command?
head -n10 /dev/ttyUSB0

yes have tried head -n10 /dev/ttyACM0 as well
same like allways ,led is flicker 3times and thats it.

Next week i get the decimiela board with the ftdi chip onboard. i am really curious what will happend then.
is the behaving different in any case between ttyACM0 and /ttyUSB0 ?
perfect for me would be if i have succes with echo "1" > /dev/ttyACM0. Makes it easy for some scripts wich i can start over the GUI on receiver.
Thank you for your information

I suspect the behaviour will be the same.

Most likely you need to disable auto-reset. I wish they had added a jumper back then instead of the solder bridge. You can shut it off by adding a capacitor.

Many Thank for that hint!!! My solution is a little bit different. I connect a 2,2 microfarad electrolytic capacitor between the 5V+ and the reset on the arduino uno.

And now i can send echo 1 > /dev/ttyACM0 to the arduino and the led is on. COOOOOL!

Thank you very much for help!! Works brilliant!!!