Closed matthijsfh closed 3 years ago
Although I maintain this repo I don't work on any issues. This sounds like a good feature. If you want to make the changes please fork the repository and make a pull request. I'll merge it in.
A better way than defines is to be able to select the port you want to use, and this feature is already implemented in version 0.9.1, You can do something like this:
nh.getHardware()->setPort(&Serial3);
nh.getHardware()->setBaud(57600);
nh.initNode();
Not very intuitive or well documented, but It does the job
@danidask pointed out a good solution. Closing.
Feature request for ArduinoHardware.h
It would be very convenient for the arduino MEGA to have a define that will use either Serial2 or Serial3.
Mega has 4 serial ports and Port "Serial1" maps onto 2 inputs with interrupt capabilities. Serial2 & Serial3 do not "block" interrupt lines and are therefore better to use for serial communication.
Serial itself is locked to the USB - serial converter by the MEGA hardware and very usefull for debugging. Having ROS Serial communication on Serial2 or Serial3 would be great.
if defined(USBCON) and !(defined(USE_USBCON))
elif defined(USE_TEENSY_HW_SERIAL) or defined(USE_STM32_HW_SERIAL)
else
endif
Thanks Matthijs