I need to read a value that will be sent by LoRa from a secondary node to the primary.
The problem is that, I can't be listening all the time to the LoRa port because I need to listen to GPS and Modem data. So I need to setup an interrupt , so that when the data comes I'll be able to read it.
I don't know for sure if some data comes to the emulated serial port, and you don't tell with Lora.listen(); to pay attention to the port, what happens with the contents? Are they still there?
If you're using SoftwareSerial then you can only listen to one port at a time. You will have no way of knowing when the LoRa is sending data if you're not listening unless it is giving you a signal on another pin. If you're not listening when the data comes then it will be lost.
There are boards with multiple serial UARTs that could listen to all of those things at once. The Mega has 4 serial ports.
Thank you, this was what I wasn't sure if it worked that way. I thought that maybe it worked like a circular buffer, and the data could be there. So I'm planning to set up an interrupt, something similar to what i used with the flasher constructor in order to blink the led, but this time to check if there's new data, which I don't know for sure if it would work because maybe it takes lots of resources,in order to avoid losing data I might have to check at a very fast rate.
Your comment on getting a signal on another pin might work also, if I understood, I can connect in parallel to the virtual SofwareSerial RX pin another IntPin and check for that pin as a hardware interrupt for instance on a positive rising edge ?
The value from the other side (the one that comes from the secondary node - LoRa) will be sent at a interval of 1 minute.
Two LoRa, DRF1276DM modules.
One sends data at a 1 minute interval with a voltage value, a float.
The other node gets that value, but I can't poll all the time because I've the main code running, and I can't halt the process, short explanation, I'm sending lots of AT commands and I can't stop in the middle to check if there's something on the SofwareSerial virtual Rx com port.