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

Arduino Serial.println and initNode()

asked 2019-02-27 01:46:26 -0500

superkuo gravatar image

updated 2019-02-27 03:13:47 -0500

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-02-27 03:15:56 -0500

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.

edit flag offensive delete link more

Comments

Thanks for the answer. That makes sense now!

superkuo gravatar image superkuo  ( 2019-03-02 19:12:58 -0500 )edit

Question Tools

Stats

Asked: 2019-02-27 01:46:26 -0500

Seen: 1,437 times

Last updated: Feb 27 '19