34 lines
605 B
C++
34 lines
605 B
C++
#include <LoRa.h>
|
|
#include "utilities.h"
|
|
|
|
int counter = 0;
|
|
|
|
void setup()
|
|
{
|
|
initBoard();
|
|
// When the power is turned on, a delay is required.
|
|
delay(1500);
|
|
|
|
Serial.println("LoRa Sender");
|
|
LoRa.setPins(RADIO_CS_PIN, RADIO_RST_PIN, RADIO_DI0_PIN);
|
|
if (!LoRa.begin(868E6)) {
|
|
Serial.println("Starting LoRa failed!");
|
|
while (1);
|
|
}
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
Serial.print("Sending packet: ");
|
|
Serial.println(counter);
|
|
|
|
// send packet
|
|
LoRa.beginPacket();
|
|
LoRa.print("hello ");
|
|
LoRa.print(counter);
|
|
LoRa.endPacket();
|
|
|
|
counter++;
|
|
|
|
delay(5000);
|
|
}
|