I’m finding the software serial interface to be a bit unstable for anything over 9600. I want to use the UART interface in normal operation but without rewriting all of my code. The best solution might be to use an alias, but you can’t instantiate/alias the Serial class the way you can SoftwareSerial. I’m a hardware guy
How can I do something like the following?
#ifdef DEBUG
#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);
Serial debugSerial;
#else
Serial wifiSerial;
#endif
void setup()
{
#ifdef DEBUG
char buf[32];
debugSerial.begin(57600);
debugSerial.println("Starting");
debugSerial.print("Free memory: ");
debugSerial.println(wifly.getFreeMemory(),DEC);
etc...