Hi everyone,
I have a library that requires a hardware Serial port for it's functions and my Arduino Uno only has one hardware Serial port. I would still like to use the Serial.print() functions to debug my program but it seems to use that same port.
Is there a way to create a software serial port and use it for printing debug messages to the Serial monitor and then use the hardware serial port for my library?
Thanks. I did know there were other boards I could use, but I just happen to only have a Arduino UNO and I have always wondered about this. Would still like to know if it is possible or not, but thank you anyway.
turn the idea upside down, can you use software serial at 9600 baud for your other connection, leaving the onboard serial for Serial Monitor use? Even if you develop in this mode, and then at the end swap ports so you can crank up the baud rate to the device, this might work for you.
Otherwise, your basic answer is "no".
This is how you can go: 1. Connect UNO's Hardware Serial Port with the PC using a USB Port. 2. Connect UNO's of Software UART Port (SUART(2, 3)) with the PC using another USB Port. The connection must agree with Fig-1.
4. Open Serial Monitor-1 with Newline option for Line ending box and Bd = 9600. 5. Open IDE-2 and detect the SUART Port at the correct virtual COM Port. 6. Open Seral Monitor-2 at Bd = 9600 from IDE-2. 7. Enter "Hello World" in the InputBox of SM-1 and then click on the Send Button. 8. Check that the message has appeared in the OutputBox of Serial Monitor-2.
The library only uses a hardware serial port. I guess it was the way the library was written. If I try to create a software serial port the compiler complains.
I made my life simpler and bought an Arduino Mega 2560 with 3 hardware serial ports.
Thank you all for your suggestions. I thought there might be a simple solution for the Arduino Uno, but I guess buying the 2560 board is probably the simplest of all.