/*
LoRa Duplex communication
Sends a message every half second, and polls continually
for new incoming messages. Implements a one-byte addressing scheme,
with 0xFF as the broadcast address.
Uses readString() from Stream class to read payload. The Stream class'
timeout may affect other functuons, like the radio's callback. For an
created 28 April 2017
by Tom Igoe
*/
#include <SPI.h> // include libraries
#include <LoRa.h>
//
//const int csPin = 7; // LoRa radio chip select
//const int resetPin = 6; // LoRa radio reset
//const int irqPin = 1; // change for your board; must be a hardware interrupt pin
String outgoing; // outgoing message
byte localAddress = 0x1A; // address of this device
long lastSendTime = 0; // last send time
int interval = 2000; // interval between sends
void setup() {
Serial.begin(9600); // initialize serial
while (!Serial);
Serial.println("LoRa Duplex");
// // override the default CS, reset, and IRQ pins (optional)
// LoRa.setPins(csPin, resetPin, irqPin);// set CS, reset, IRQ pin
if (!LoRa.begin(433E6)) { // initialize ratio at 915 MHz
Serial.println("LoRa init failed. Check your connections.");
while (true); // if failed, do nothing
}
Serial.println("LoRa init succeeded.");
}
void loop() {
if (millis() - lastSendTime > interval) {
String message = "1A "; // send a message
sendMessage(message);
Serial.println("From " + message);
lastSendTime = millis(); // timestamp the message
interval = random(2000) + 9000; // 2-3 seconds
}
// parse for a packet, and call onReceive with the result:
onReceive(LoRa.parsePacket());
}
void sendMessage(String outgoing) {
LoRa.beginPacket(); // start packet
LoRa.print("1A "); // add sender address
LoRa.endPacket(); // finish packet and send it
}
void onReceive(int packetSize) {
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());
}
}
This is the code of my LoRa half duplex coding, it is transmitting and receiving to/from another 19 LoRa.
My problem is how to retrieve the data from 20 LoRa wirelessly by not using the cable.
https://store.arduino.cc/usa/arduino-nano
The link above is the arduino nano i use.
The link above shows the LoRa Ra-01 i use.
The RSS is Received Signal Strength, it measure the signal between two LoRa.
I know how to obtain the data by plug them into my computer, but i don't know how to obtain them wirelessly.
The data i want to obtain is the RSS value.