ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Rosserial connection doesn't work due to signal

asked 2017-05-08 08:23:56 -0600

jonagf gravatar image

updated 2017-05-08 08:46:27 -0600

Hi all,

I have an arduino MEGA and I want to communicate via rosserial with my ros node.

Somewhere in my arduino code I have the following line.

if(intensity[n] <= myCounter) 
{
        digitalWrite((2*(n-8))+shiftSaidaInicial, LOW);
}

When I try to make the connection running rosrun rosserial_python serial_node.py /dev/ttyACM0 it says that it's unnable to conenct to the device.

However, if I change the previous line to the following it syncs perfectly.

if(intensity[n] >= myCounter) 
{
        digitalWrite((2*(n-8))+shiftSaidaInicial, LOW);
}

The only thing I changed was the <= to >=. Sadly, so the code makes sense, I need the <= instead..

Anyone knows why this is happening?

Thanks!

edit retag flag offensive close merge delete

Comments

I'm not an Arduino expert, but does it use pin-multiplexing for the serial and the DOUT? If so, your first version may be messing with some of the pins needed for your serial connection.

gvdhoorn gravatar image gvdhoorn  ( 2017-05-08 11:38:14 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-30 18:36:00 -0600

rreignier gravatar image

As @gvdhoorn mentioned, if n == 0, you will apply digitalWrite() on the pin 0 that is the serial RX pin on the Arduino MEGA and the serial communication will no longer work.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-05-08 08:23:56 -0600

Seen: 204 times

Last updated: Sep 30 '17