arduino/Examples/LoRaTests/Client/Client.ino

53 lines
818 B
Arduino
Raw Permalink Normal View History

2019-06-21 16:12:29 +00:00
#include <SPI.h>
#include <LoRa.h>
// The dragino shield
#define PIN_SS 10
#define PIN_RESET 9
#define PIN_DIO0 2
// Wemos
//#define PIN_SS 15
//#define PIN_RESET 4
//#define PIN_DIO0 5
// Custom: The smart greenhouse device
//#define PIN_SS 10
//#define PIN_RESET -1
//#define PIN_DIO0 2
// Channel 0
#define FREQUENCY 868100000
int counter = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
LoRa.setPins(PIN_SS, PIN_RESET, PIN_DIO0);
if (!LoRa.begin(FREQUENCY)) {
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);
}