Farm-Data-Relay-System/examples/Universal_Sensor_beta/Universal_Sensor_beta.ino

41 lines
802 B
Arduino
Raw Normal View History

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".
//
//#include "fdrs_sensor_config.h"
#include "fdrs_sensor.h"
2022-06-30 13:30:24 +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);
#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() {
return random(0,100);
2022-06-30 13:30:24 +00:00
}