-
-
Notifications
You must be signed in to change notification settings - Fork 657
Description
Hi Guys,
Sorry I am new to this but cannot find how to resolve online. I want to use this libary when not connected to my PC. As soon as I disconnect the Arduino from the PC or dont have the IDE open the <LoRa.h> file does not run. is there a way to have this on the arduino itself so it runs independently? The other issue I cant seem to overcome is on the reciever code, I would like to be able to use the inbound message to light a green led if message is GoGreen and red LED if GoRed. I am using the below code but I cant get it right. Thank you in advance.
void onReceive(int packetSize) {
if (packetSize == 0) return; // if there's no packet, return
// read packet header bytes:
String incoming = "";
while (LoRa.available()) {
incoming += (char)LoRa.read();
}
Serial.println("RSSI: " + String(LoRa.packetRssi()));
Serial.println("Snr: " + String(LoRa.packetSnr()));
Serial.println(incoming);
if ((Serial.println(incoming)) == (GoGreen));
digitalWrite(Green, HIGH);
digitalWrite(Red, LOW);
if ((Serial.println(incoming)) == (GoRed));
digitalWrite(Green, LOW);
digitalWrite(Red, HIGH);