Hi everyone, this is my first post on the forums so please be lenient on whatever mistakes I made with my post (typos, weird title/format etc...).
I'm currently doing a mini project involve posting parameters gathered by my weather station (consists of sensors BME280 and BH1750) to Google Sheet, which will be processed and print Status "YES" or "NO" on a column. With "YES", the board will turn the motor and close off my house's terrace, which will prevent my clothes from getting wet due to raining. With "NO", the board will check whether the cover is closed or not, and proceed to do nothing or retract the cover. Here is additional infos:
Hardware used : Wemos D1 R32 with ESP32 chip, BME280, BH1750, L298n motor driver
Software used: Google App Script, Arduino IDE.
Libraries used: WiFi.h, ArduinoJson.h, HTTPClient.h.
As mentioned prior, the parameters gathered by my weather station to my Google Sheet, which will be processed and the Google Script I wrote will then write "YES" or "NO" on the status column. Which the esp board will send a request GET to get the status and use it to determine whether to turn the motor on or off. I used the standard HTTPClient to connect to Google Script server and post the parameters, so far so good, but when I send my GET request, an error occured. Here is my test code and the error console (I was running verbose debug mode) :
Codes:
Arduino:
#include <WiFi.h>
#include <HTTPClient.h>
#include <iostream>
#include "ArduinoJson.h"
const char* ssid = "somewhere";
const char* password = "someplace";
StaticJsonDocument<300> doc;
const char* Status = doc["Status"];
void setup() {
Serial.begin(115200);
delay(1000);
WiFi.mode(WIFI_STA);
delay(300);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
Serial.println(WiFi.status());
}
Serial.println("Connected to the WiFi network");
if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
HTTPClient http;
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
http.begin("https://script.google.com/macros/s/AKfycbzgifMKsPof-z0b8t0KBCAVT2Daysya-XMq_XevANOR25ElRFJwpTN-p512Ltw8H2tb/exec"); //Specify the URL and certificate
int code = http.GET();
if (code > 0) { //Check for the returning code
String payload = http.getString();
DeserializationError error = deserializeJson(doc, payload);
// Test if parsing succeeds.
if (error) {
Serial.println(F("DeserializeJson() failed:"));
Serial.println(error.f_str());
return;
}
Serial.println(payload);
Serial.println(Status);
}
else {
Serial.println("Error on HTTP request");
}
http.end(); //Free the resources
delay(10000);
}
}
void loop() {
}
I encounterd a very strange Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Which after some investigation, seemed to be due to memory access violation, however i didn't utilised any advanced code and pretty much all derived from what I read on the Internet. I don't really have the adequate background to tell what is amiss so I'd like to ask for help from people more knowledgeable on these matters.
Thanks in advance!