1
0
mirror of https://github.com/sandeepmistry/arduino-LoRa.git synced 2025-06-15 18:01:42 +03:00

non blocking functions added (#62)

This commit is contained in:
Samuel Lang
2018-08-19 16:34:32 +02:00
committed by Sandeep Mistry
parent 07bfead143
commit 9d2a8c9c82
5 changed files with 72 additions and 10 deletions

View File

@ -0,0 +1,35 @@
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender non-blocking");
if (!LoRa.begin(915E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
// wait until the radio is ready to send a packet
while (LoRa.beginPacket() == 0) {
Serial.print("waiting for radio ... ");
delay(100);
}
Serial.print("Sending packet non-blocking: ");
Serial.println(counter);
// send in async / non-blocking mode
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket(true); // true = async / non-blocking mode
counter++;
}