Now this might have been asked before but because of the numerous update I want to double check. I am writing a custom library for communication between Dynamixel xl320 servos and Arduino Mega. I want to use all instances Serial1, Serial2 and Serial3 corresponding to the hardware ports on the board.
Where are these defined? Which headers I need to include in my library? More importantly what is the name of their class? I want to be able to declare a pointer or reference to each Serial so that I can make my library work for any Serial port. To be able to do that, though, I need to specify a type for the pointer.
While on the subject I would like to ask another question. Some people suggested that it is not a good idea to use functions like Serial.read() and Serial.write() directly in a custom made library. As far as I know it would not make any difference to the compiler where I use the functions as long as I include the appropriate headers. Does anyone have experience with that and is it indeed safe?