I'm trying to send NMEA 0183 sentences through LoRa. Every dinstict NMEA message looks like several char arrays (sentences) followed by '\n'. In the below picture we see one NMEA distinct message:
This message arrives in the Arduino input buffer every 1 second with differentiated values (numbers) and it has to be sent over LoRa as fast as possible. In order to send it over LoRa I need to read all bytes on the input buffer and assign them to an array and send them as an array, not one by one. I know that Serial.read() reads only one byte, and that's the problem. How can I read all bytes and send them as a whole?
This is my code:
if (Serial.available()) {
c = Serial.read();
rf95.send((char *)c, sizeof(c));
rf95.waitPacketSent();
I use RadioHead library, and the definition of rf.95.send is: RH_RF95::send (const uint8_t * data, uint8_t len)
c is of char type.