2018-03-27 17:00:33 +02:00
|
|
|
#include <SPI.h>
|
|
|
|
#include <LoRa.h>
|
|
|
|
|
|
|
|
int counter = 0;
|
|
|
|
char mes[] = "message :";
|
|
|
|
|
|
|
|
void setup() {
|
2018-04-12 14:55:36 +02:00
|
|
|
SerialUSB.begin(9600);
|
2018-03-27 17:00:33 +02:00
|
|
|
while (!Serial);
|
|
|
|
|
2018-04-12 14:55:36 +02:00
|
|
|
SerialUSB.println("LoRa Sender");
|
2018-03-27 17:00:33 +02:00
|
|
|
|
2018-04-07 17:27:59 +02:00
|
|
|
if (!LoRa.begin(868E6)) {
|
2018-04-12 14:55:36 +02:00
|
|
|
SerialUSB.println("Starting LoRa failed!");
|
2018-03-27 17:00:33 +02:00
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2018-04-12 14:55:36 +02:00
|
|
|
SerialUSB.print("paquet envoyé : ");
|
|
|
|
SerialUSB.println(counter);
|
2018-03-27 17:00:33 +02:00
|
|
|
|
|
|
|
// send packet
|
|
|
|
LoRa.beginPacket();
|
|
|
|
LoRa.print("message : ");
|
|
|
|
LoRa.print(counter);
|
|
|
|
LoRa.print("\n");
|
|
|
|
LoRa.endPacket();
|
|
|
|
|
|
|
|
counter++;
|
|
|
|
|
2018-04-07 17:27:59 +02:00
|
|
|
delay(5000);
|
2018-03-27 17:00:33 +02:00
|
|
|
}
|