I wrote a library for an LCD screen that I have and I want to expand dynamically. I have an Arduino Mega 2560 board, and inherently, 4 different serial TX ports accessed via Serial, Serial1, Serial2, and Serial3. Currently I have the library hard coded to use Serial1, which is fine for this project, but how would I go about passing type Serial to the library? Example:
#include <LCD.h>
LCD lcd1;
LCD lcd2;
LCD lcd3;
void setup()
{
lcd1 = LCD(Serial);
lcd2 = LCD(Serial1);
lcd3 = LCD(Serial3);
}
void loop()
{
lcd1.printToLCD("This screen uses Serial on pin 1");
lcd2.printToLCD("This screen uses Serial on pin 18");
lcd3.printToLCD("This screen uses Serial on pin 14");
}
Basically, what Class or type are variables Serial, Serial1, Serial2 and Serial3?
Thanks,
Stauffski