I am doing an Arduino project with a partner. We both did a part of the design using serial outputs (one over USB, one over Tx, Rx pins). When we try to put them both together, they don’t work, the two serial outputs end up screwing up each other. Any way to make two different serial objects with the Arduino?
Here’s more details.
The first serial connection is started with:
Serial.begin(9600);
and uses output like :
Serial.print("Outside Temp: ");
Serial.print(tOut);
To print text to the Serial Monitor.
The other Serial Connection is started with:
Serial.begin(115200);
and uses output like :
Serial.write(0xFF);
Serial.write(0xAA);
to control a device connected to the Tx Rx pins.
Of course, when we put our code together our two serial outputs are not separated and just screw up each others outputs. How to make two serial objects using the Arduino IDE? One serial object should communicate over the USB cable, and the other serial object should communicate over the Tx, Rx pins.
Thanks
Drew
This competition (Hackathon) is providing the board to use, so it will be the UNO, but great to know about the other boards for future projects.
I'll give that software serial a try!
Hmmmm
This SoftwareSerial looks like just what I need, but I'm getting a
“call of overloaded 'write(int)' is ambiguous” error. Can you take a quick look at this?
But, when compiling, on the 13 mySerial.write statement, I get the error:
call of overloaded 'write(int)' is ambiguous.
If I comment out that line, the error moves up one. I continue with that and the error moves up one but always on 0x00 (not other numbers). If I comment out all write statements with 0x00 the program complies but doesn’t run my device of course.
Any idea why
mySerial.write(0x00);
would cause
call of overloaded 'write(int)' is ambiguous.
but other write statements are OK? How to make a valid mySerialWrite(0x00)?
"call of overloaded 'write(int)' is ambiguous" error. Can you take a quick look at this?
Is there some part of that message that does not make sense? In the absence of any directive to the contrary, all literals are ints. You need to either cast all those values to bytes OR (and this is far better) store the values in a byte array and use either a for loop or the overload that takes an array and a length.