-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodo_hijo.ino
84 lines (63 loc) · 1.79 KB
/
nodo_hijo.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#define ID_NODO ("35")
#define PATH ("/CSVnodoHijo_35.txt")
#define PATH2 ("/CopiaCSVnodoHijo_35.txt")
#define DATA_TOTAL ("/dataTotal_hijo_35.txt")
#include <WiFi.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
#define BME_ADDRESS (0x76)
// variables del sleep
// #define TIME_OF_SAMPLING 3600000 //1 hora
#define SAMPLING_TIME 3600000 // 900000//3600000 //240000 //2 minutos prueba
#define CONECTION_TIME 180000//5000//180000 // tiempo en que se espera la conexion al nodo padre
#define mS_TO_uS_FACTOR 1000 // factor para pasar milis a micro segundos
#define S_TO_mS_FACTOR 60000 // factor para pasar segundos a milisegundos segundos
const char *ssid = "GIDEAMSERVER";
const char *password = "1234567890";
String serverName = "http://192.168.4.1/";
const char *pathData = "data";
const char *pathHora = "hora";
String responseHora;
Adafruit_BME280 bme;
unsigned long lastTime = 0;
unsigned long timerDelay = 0;
// variables HD38
#define sensorPin 26 // Pin analógico conectado al sensor
// bateria
#define bateryPin 33
// varibles SOIL NPK MODBUS
#define RE 15
#define RXD2 16
#define TXD2 17
//pin led
#define LED 32
boolean stateLed = true;
#define PIN_CONTROL 25
#include "usb_functions.h";
#include "tinyRTC_functions.h";
#include "mediciones.h";
void setup()
{
Serial.begin(115200);
pinMode(LED,OUTPUT);
digitalWrite(LED,stateLed);
pinMode(PIN_CONTROL,OUTPUT);
digitalWrite(PIN_CONTROL,stateLed);
while (!Serial)
{
Serial.print("."); // Espera hasta que el puerto serial se conecte
}
Serial.print("Nodo: ");
Serial.println(ID_NODO);
Wire.begin();
setupRTC();
setUp();
sendData();
flag = true;
// modo deep sleep
Serial.println("entrando a modo deep sleep");
sleepEsp();
}
void loop() {}