Ask Your Question

Revision history [back]

You need to find the ArduinoHardware.h file in your machine (it's usually in your libraries folder somewhere in ros_lib) and change this line to use the Serial you want (e.g. iostream = &Serial1;)

Hope it helps!

You need to find the ArduinoHardware.h file in your machine (it's usually in your libraries folder somewhere in ros_lib) and change this line to use the Serial you want (e.g. iostream = &Serial1;)

Hope it helps!

Sorry, I don't know why I didn't see that on the OP.

Here's what I've found, you should create a new Hardware definition class in your sketch and specify the port you want there and instanciate it when you create the nodeHandle object.

class NewHardware : public ArduinoHardware
{
  public:
  NewHardware():ArduinoHardware(&Serial1, 57600){};
};

ros::NodeHandle_<NewHardware>  nh;

I don't have a Mega to test this so I used a regular UNO and re-specified &Serial as the serial port and it worked.

Hope it helps!