mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
add LoRa controller example
This commit is contained in:
parent
a57e921e45
commit
5f2fd0e586
26
examples/LoRa_Controller/LoRa_Controller.ino
Normal file
26
examples/LoRa_Controller/LoRa_Controller.ino
Normal file
@ -0,0 +1,26 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// ESP-NOW Sensor Example
|
||||
//
|
||||
// Developed by Timm Bogner (timmbogner@gmail.com) for Sola Gratia Farm in Urbana, Illinois, USA.
|
||||
// An example of how to send data via ESP-NOW using FDRS.
|
||||
//
|
||||
|
||||
#include "fdrs_node_config.h"
|
||||
#include <fdrs_node.h>
|
||||
|
||||
void fdrs_recv_cb(DataReading theData) {
|
||||
DBG("ID: " + String(theData.id));
|
||||
DBG("Type: " + String(theData.t));
|
||||
DBG("Data: " + String(theData.d));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
beginFDRS();
|
||||
//pingFDRS(1000);
|
||||
addFDRS(fdrs_recv_cb);
|
||||
subscribeFDRS(READING_ID);
|
||||
}
|
||||
void loop() {
|
||||
loopFDRS();
|
||||
}
|
22
examples/LoRa_Controller/fdrs_node_config.h
Normal file
22
examples/LoRa_Controller/fdrs_node_config.h
Normal file
@ -0,0 +1,22 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
// Node Configuration
|
||||
|
||||
#include <fdrs_globals.h>
|
||||
|
||||
#define READING_ID 1 //Unique ID for this sensor
|
||||
#define GTWY_MAC 0x01 //Address of the nearest gateway
|
||||
|
||||
//#define USE_ESPNOW
|
||||
#define USE_LORA
|
||||
//#define DEEP_SLEEP
|
||||
//#define POWER_CTRL 14
|
||||
#define FDRS_DEBUG
|
||||
|
||||
// LoRa Configuration
|
||||
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
|
||||
#define LORA_SS 18
|
||||
#define LORA_RST 14
|
||||
#define LORA_DIO 26
|
||||
|
||||
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
|
||||
#define LORA_ACK // Request LoRa acknowledgment.
|
Loading…
Reference in New Issue
Block a user