Skip to content

Commit

Permalink
OFFICIAL STABLE RELEASE - Root NodeMCU v1.2.7
Browse files Browse the repository at this point in the history
OFFICIAL STABLE RELEASE - Root Module, NodeMCU v3 (LoLin) Code Version 1.2.7 Revision March 22, 2020
  • Loading branch information
royjosephargumido authored Mar 22, 2020
1 parent c0f7808 commit 18bdc7c
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions Releases/Root/RootNodeMCU/RootNodeMCU.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
The S.A.R.I.B.O. Leaf Module - NodeMCU 12E esp8266 Module Code
Systematic and Automated Regulation of Irrigation systems for Backyard farming Operations
SARIBO WIFI COMMUNICATION STABLE PROTOTYPE - ROOT MODULE
Compatible to SARIBO Leaf Version 1.2.7 and higher
Version 1.1.3 Revision March 21, 2020
OFFICIAL STABLE RELEASE - Root Module, NodeMCU v3 (LoLin) Code
Version 1.2.7 Revision March 22, 2020
BSD 3-Clause License
Copyright (c) 2020, Roy Joseph Argumido (rjargumido@outlook.com)
Expand Down Expand Up @@ -40,8 +39,10 @@
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <RTClib.h> // Provides the Date Time functionality
#include <SoftwareSerial.h>

RTC_DS3231 rtc; // Creates the RTC object
SoftwareSerial s(3,1);

//================= NETWORK PARAMETERS ===============
const char* ssid = "SARIBO Server - Argumido";
Expand All @@ -50,11 +51,18 @@ const char* host = "192.168.4.1";
String urlPath = "/requests/";

ESP8266WebServer server(80);
//====================================================

//=============== ARDUINOJSON COMPONENTS =============
DeserializationError err;
const size_t capacity = JSON_OBJECT_SIZE(5) + 90;

const size_t capacity = JSON_OBJECT_SIZE(5) + 90; //For WiFi Communication
DynamicJsonDocument requestData(capacity);
DynamicJsonDocument responseData(capacity);

const size_t serbuff = JSON_OBJECT_SIZE(2) + 50; //For Serial Communication
DynamicJsonDocument serialData(serbuff);

String requestPayload = "";
String responsePayload = "";
//====================================================
Expand Down Expand Up @@ -167,6 +175,13 @@ void handleRoot() {
int request = requestData["request"];
int value = requestData["value"];

//============= SERIAL COMMUNICATION =============
serialData["origin"] = origin;
serialData["request"] = request;

serializeJson(serialData, s);
//================================================

Serial.println("============ REQUEST INFORMATION ============");
Serial.print("Origin: ");
Serial.println(origin);
Expand Down Expand Up @@ -241,7 +256,8 @@ void startServer() {

void setup() {
Serial.begin(115200);

s.begin(9600);

performRTCCheck(); // Checks the presence of the RTC module during program start

startServer();
Expand Down

0 comments on commit 18bdc7c

Please sign in to comment.