Hi!
I have connected external devices to Serial4 and Serial5 of the Electron and when there is incoming data on the interface, the code below runs just fine. However, when the other device is not connected, after a few iterations the whole process just hangs. (The number of iterations is always changing, I don’t know what does it depend on).
Am I doing something wrong or is this a bug in the firmware? Is there an other way to know if the serial link is connected? Since I only need to receive data, I only connected GND and RX.
Suggestions are greatly appreciated.
excerpt:
do
{
while (
(Serial5.available() > 0)
)
{
incomingText ="";
bool lineBreak = false;
do {
int inByte = Serial5.read();
inByte == 13 ? lineBreak = true : lineBreak = false;
if (inByte != -1 && inByte != 10 ) {
incomingText = incomingText + char(inByte);
}
} while (!lineBreak);
doStuff();
}
}
} while ((millis() - startProcessingTime) < 0.25*60*1000 );