since you're checking for serial input, just once in setup, what happens if there's not serial data at that time? what gets printed if there's no serial data
gcjr:
since you're checking for serial input, just once in setup, what happens if there's not serial data at that time? what gets printed if there's no serial data
Even when it's put into void loop(), the same thing happens (zero indefinitely).
gcjr:
does the tx pin need to be configured as an OUTPUT?
see SoftwareSerial:
Ough, thanks for the suggestion! Although, I tried that just now, and it did not make a difference. I'm keeping it in though. I think that's the correct way from the link.
Both the sending and receiving Arduino needed pinMode defined:
This makes no sense given the source code for SoftwareSerial.h. I see both pins set to the correct pinMode in the library for the AVR boards like the UNO, Nano, etc.
void SoftwareSerial::setTX(uint8_t tx)
{
// First write, then set output. If we do this the other way around,
// the pin would be output low for a short while before switching to
// output high. Now, it is input with pullup for a short while, which
// is fine. With inverse logic, either order is fine.
digitalWrite(tx, _inverse_logic ? LOW : HIGH);
pinMode(tx, OUTPUT);
_transmitBitMask = digitalPinToBitMask(tx);
uint8_t port = digitalPinToPort(tx);
_transmitPortRegister = portOutputRegister(port);
}
void SoftwareSerial::setRX(uint8_t rx)
{
pinMode(rx, INPUT);
if (!_inverse_logic)
digitalWrite(rx, HIGH); // pullup for normal logic!
_receivePin = rx;
_receiveBitMask = digitalPinToBitMask(rx);
uint8_t port = digitalPinToPort(rx);
_receivePortRegister = portInputRegister(port);
}