Skip to content

Libary use #704

@RobSoeberg

Description

@RobSoeberg

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions