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

51 lines
909 B
Arduino
Raw Normal View History

2022-08-13 01:56:29 +00:00
// 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_sensor_config.h"
#include <fdrs_node.h>
float data1;
float data2;
2022-08-13 12:47:40 +00:00
void ctrl_1_cb(DataReading* theData) {
DBG("Controller1");
}
void ctrl_2_cb(DataReading* theData) {
DBG("Controller2");
}
void ctrl_3_cb(DataReading* theData) {
DBG("Controller3");
}
void ctrl_4_cb(DataReading* theData) {
DBG("Controller4");
}
2022-08-13 01:56:29 +00:00
void setup() {
beginFDRS();
addFDRS(1000);
2022-08-14 01:47:10 +00:00
pingFDRS(1000);
2022-08-13 01:56:29 +00:00
}
void loop() {
2022-08-14 01:47:10 +00:00
// data1 = readHum();
// loadFDRS(data1, HUMIDITY_T);
// data2 = readTemp();
// loadFDRS(data2, TEMP_T);
// sendFDRS();
// sleepFDRS(10); //Sleep time in seconds
2022-08-13 01:56:29 +00:00
}
float readTemp() {
return 22.069;
}
float readHum() {
2022-08-13 12:47:40 +00:00
return random(0, 100);
2022-08-13 01:56:29 +00:00
}