What is the whole story going on in the while loop?
In this while loop the data packet prints on the Lcd .
while (LoRa.available())
{
incoming = ((char)LoRa.read());
//Serial.print((char) LoRa.read());
Serial.print(incoming);
lcd.print(incoming);
}
Serial.print("' with RSSI ");// print RSSI of packet
Serial.println(LoRa.packetRssi());
lcd.setCursor(0, 1);
lcd.print(" ");//Clear previous digits
lcd.setCursor(0, 1);
lcd.print(LoRa.packetRssi());//This works on LCD outside the while loop.
lcd.setCursor(0, 0);//Set Cursor for next print loop
}
}
But when I move the lcd.print out of the while loop I only get 1 digit again!
while (LoRa.available())
{
incoming = ((char)LoRa.read());
//Serial.print((char) LoRa.read());
Serial.print(incoming);
}
lcd.print(incoming);//Move lcd.print here!!
Serial.print("' with RSSI ");// print RSSI of packet
Serial.println(LoRa.packetRssi());
lcd.setCursor(0, 1);
lcd.print(" ");//Clear previous digits
lcd.setCursor(0, 1);
lcd.print(LoRa.packetRssi());//This works on LCD
lcd.setCursor(0, 0);//Set Cursor for next print loop
}
}
My understanding is that when the LoRa packet is received the while loop is entered then the packet is read and type cast to char and then stored in variable incoming.
Done finish exit while loop.
Next line is lcd.print(incoming) .. only 1 digit is displayed.
But when I remove incoming and change the line to:
lcd.print("abcdefg");
The abcdefg is printed on the lcd?
Something else is going on here that I cannot see .. Please explain.