Go Down

Topic: Bash comm. with arduino uno over ttyACMx (Read 1 time) previous topic - next topic

andil

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

madworm

portspeed ?

Code: [Select]
stty -F /dev/ttyACM0 9600

does it work with screen ?

Code: [Select]
screen /dev/ttyACM0
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

andil

Hi,

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

pantonvich

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




andil

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.


Go Up