I am very new at this but slowly learning.
I have a LoRa remote transmitter (MKR1310) that I made to monitor water levels. It sends a daily message 'LowWater' if more water is needed. 'OkWater' of water is ok. That part is working fine.
I also have a MKR1310 that is receiving those transmissions just fine but I want to make a conditional 'If transmission contains 'LowWater' then turn on something'. I have been trying to figure this out for days and Im stuck.
I was using a Heltec LoRa and found an example that worked but I want to use the 1310 now instead and it appears to use different syntax and libraries that are not compatible.
The Heltec code section that works (keep in mind I have very little understanding of HOW it works.. just it made my LED light up as designed )
if(strncmp(Readback, "LowWater", strlen(Readback)) == 0) {
digitalWrite(LED, HIGH);
Serial.print("Low Water Level '");
}
What would I need to do to get that same/similar result here?:
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
// while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
Thank you VERY much in advance!!!