You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
522 B
Arduino
34 lines
522 B
Arduino
7 years ago
|
#include <SPI.h>
|
||
|
#include <LoRa.h>
|
||
|
|
||
|
int counter = 0;
|
||
|
char mes[] = "message :";
|
||
|
|
||
|
void setup() {
|
||
7 years ago
|
SerialUSB.begin(9600);
|
||
7 years ago
|
while (!Serial);
|
||
|
|
||
7 years ago
|
SerialUSB.println("LoRa Sender");
|
||
7 years ago
|
|
||
7 years ago
|
if (!LoRa.begin(868E6)) {
|
||
7 years ago
|
SerialUSB.println("Starting LoRa failed!");
|
||
7 years ago
|
while (1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
7 years ago
|
SerialUSB.print("paquet envoyé : ");
|
||
|
SerialUSB.println(counter);
|
||
7 years ago
|
|
||
|
// send packet
|
||
|
LoRa.beginPacket();
|
||
|
LoRa.print("message : ");
|
||
|
LoRa.print(counter);
|
||
|
LoRa.print("\n");
|
||
|
LoRa.endPacket();
|
||
|
|
||
|
counter++;
|
||
|
|
||
7 years ago
|
delay(5000);
|
||
7 years ago
|
}
|