i'm using the GPS shield connected with I2C and i need to get it's datas when there is some, with the rest of the program still running. right now i test if there is new data every seconds, then send the datas with LoRa. but the GPS data are always 0. i think it's because i don't read the GPS data when they are here... i want to interrupt the program when there is new GPS data, read them, then go back the the main program. is it possible and how can i do it ?
void loop(){
if (GPS.available()) {
latitude = GPS.latitude();
longitude = GPS.longitude();
altitude = GPS.altitude();
speed = GPS.speed();
satellites = GPS.satellites();
}
//rest of my program (mostly measures and LoRa communications)
delay(1000);
}