Most programs follow this route: They have a Serial.begin()
for the serial connection between PC and Arduino (the serial monitor) and they use SoftwareSerial for a device.
Can you go the other way around? Can you use SoftwareSerial for the communication between PC and Arduino, and Serial for a device?
2 Answers 2
Short answer: no.
Pins 0 and 1 an an Uno are directly wired to the PC communication chip. You could make a board that was wired differently and connected SoftwareSerial to the PC, but you would have to switch it back to pins 0 and 1 when uploading to the arduino somehow.
On an arduino leonardo "Serial" for communicating with PC over USB is different from "Serial1", which is connected to pins 0 and 1 on the board. You can use both simultaneously, so if you really need to use hardware serial and PC comms at the same time, I recommend you buy a leonardo.
-
But of course, you can omit the communication with the pc and have the hardware serial dedicated for communication with a device correct? And use the softwareserial for communicatoin with another device.user1584421– user15844212014年06月26日 09:48:51 +00:00Commented Jun 26, 2014 at 9:48
-
Yes that is correct, If you don't communicate with the PC hardware serial can be used for anything you please, and at the same time as Software Serial.BrettFolkins– BrettFolkins2014年06月26日 17:58:32 +00:00Commented Jun 26, 2014 at 17:58
Yes you can. If you use a USB FTDI type cable to connect your computer to the SoftwareSerial pins, you can use a terminal emulator program (HyperTerm, putty, etc) to communicate with the Arduino.