First time here? Check out the FAQ!


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

Arduino Serial.println and initNode()

asked Feb 27 '19

superkuo gravatar image

updated Feb 27 '19

gvdhoorn gravatar image

Hi, I am new to ROS and am currently playing around with Arduino. I came across this problem where after I initNode(), the output in serial monitor turns into backward question marks.

  void setup() {
    Serial.begin(9600);

    //nh.initNode();
    //nh.subscribe(sub);

    //myservo.attach(SERVO_PIN);
  }

    void loop() {
    Serial.println(15);//used for testing println
    nh.spinOnce();
    delay(100);
  }

if I comment nh.initNode() the serial monitor works fine. If I uncomment it, the serial monitor turns into backward question marks. Thanks a lot!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered Feb 27 '19

gvdhoorn gravatar image

You cannot use rosserial and Serial.println() at the same time -- or at least: not with the same serial port.

rosserial must have (and assumes) exclusive use of the serial port it uses to communicate with your host. Otherwise it cannot work.

Preview: (hide)

Comments

Thanks for the answer. That makes sense now!

superkuo gravatar image superkuo  ( Mar 3 '19 )edit

Question Tools

Stats

Asked: Feb 27 '19

Seen: 1,565 times

Last updated: Feb 27 '19