This commit is contained in:
2022-09-08 16:33:47 +02:00
parent cdb9dc2121
commit 40a6a58e72
3 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Applejack is best pony ! Received by Pauline Srifi ~");
if (!LoRa.begin(864E6)) {
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());
}
}

View File

@ -0,0 +1,32 @@
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Applejack is best pony ! Send by Pauline Srifi ~");
if (!LoRa.begin(864E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// send packet
LoRa.beginPacket();
LoRa.print("Hey Applejack ! How many apple did you sold ?\n I sell ");
LoRa.print(counter);
LoRa.println("apples");
LoRa.endPacket();
counter++;
delay(5000);
}