2022-06-30 13:30:24 +00:00
|
|
|
|
|
|
|
// FARM DATA RELAY SYSTEM
|
|
|
|
//
|
|
|
|
// Basic Sensor Example
|
|
|
|
//
|
|
|
|
// Developed by Timm Bogner (bogner1@gmail.com) for Sola Gratia Farm in Urbana, Illinois, USA.
|
|
|
|
// An example of how to send data using "fdrs_sensor.h".
|
|
|
|
//
|
|
|
|
|
2022-07-14 13:29:54 +00:00
|
|
|
//#include "fdrs_sensor_config.h"
|
2022-07-01 12:29:39 +00:00
|
|
|
#include "fdrs_sensor.h"
|
2022-06-30 13:30:24 +00:00
|
|
|
|
2022-07-12 13:12:34 +00:00
|
|
|
#if defined(USE_LORA)
|
2022-07-07 10:37:04 +00:00
|
|
|
FDRSLoRa FDRS(GTWY_MAC,READING_ID,SPI_MISO,SPI_MOSI,SPI_SCK,LORA_SS,LORA_RST,LORA_DIO0,FDRS_BAND,FDRS_SF);
|
2022-07-12 13:12:34 +00:00
|
|
|
#elif defined(USE_ESPNOW)
|
|
|
|
FDRS_EspNow FDRS(GTWY_MAC, READING_ID);
|
|
|
|
#endif
|
2022-06-30 13:30:24 +00:00
|
|
|
|
|
|
|
float data1;
|
|
|
|
float data2;
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
FDRS.begin();
|
|
|
|
}
|
|
|
|
void loop() {
|
|
|
|
data1 = readHum();
|
|
|
|
FDRS.load(data1, HUMIDITY_T);
|
|
|
|
data2 = readTemp();
|
|
|
|
FDRS.load(data2, TEMP_T);
|
|
|
|
FDRS.send();
|
|
|
|
FDRS.sleep(10); //Sleep time in seconds
|
|
|
|
}
|
|
|
|
|
|
|
|
float readTemp() {
|
|
|
|
return 42.069;
|
|
|
|
}
|
|
|
|
|
|
|
|
float readHum() {
|
2022-07-12 09:21:46 +00:00
|
|
|
return random(0,100);
|
2022-06-30 13:30:24 +00:00
|
|
|
}
|