I am trying to make a Software serial "receiver" wait around until data is present if its not already there to be read.
Probably, in practice, use software serial , but anyhow, was thinking along the lines of:
I realise its blocking , but thats not an issue:
void setup()
{
Serial.begin (19200);
bool A = true;
// do other stuff other setup type stuff
//..........
//...........
// related to getting inital setup parameters from another processor :
if (Serial.available > 0)
{
READIT();
A = false;
}
while ((A == true) && (Serial.available == 0))
{
delay(50);
if (Serial.available > 0)
{
READIT();
A = false;
}
}
}// end setup
void READIT()
{
//read data from serial port.
}
seems a bit "clunky", so wondered if there was a more elegant route ?
Yep I’m happy with software serial , it’s reading the data , but making it hang around if the data is not there .
I’ve looked at serial basics , doesn’t cover this situation.