Hi experts,
I am facing a problem after esp32 core updated to 3.1.3. The device is not booting after uploading. I have tested with 3 different boards, I have tried to solve this issue but its beyond my limit. I had tested with many sketches but result is same.I need an immediate help to resolve this issue.
The tested sketch is below:
I had tested many sketches but result is same.
# define ENABLE_DEBUG
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include "thermistor.h"
// Replace with your network credentials
const char* ssid = "SUNIL-WiFi-2G";
const char* password = "Aarush@2011";
// REPLACE with your Domain name and URL path or IP address with path
const char* serverName = "https://cloudcontrol.tech/post-esp-data.php";
// Keep this API Key value to be compatible with the PHP code provided in the project page.
// If you change the apiKeyValue value, the PHP file /post-esp-data.php also needs to have the same key
String apiKeyValue = "tPmAT5Ab3j7F9";
String sensorName = "BME280";
String sensorLocation = "Office";
// Analog pin used to read the NTC
#define NTC_PIN 34
// Thermistor object
THERMISTOR thermistor(NTC_PIN, // Analog pin
10000, // Nominal resistance at 25 ºC
3950, // thermistor's beta coefficient
10000); // Value of the series resistor
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("Connecting");
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to WiFi network with IP Address: ");
Serial.println(WiFi.localIP());
}
void RequestData() {
//Check WiFi connection status
if(WiFi.status()== WL_CONNECTED){
WiFiClientSecure *client = new WiFiClientSecure;
client->setInsecure(); //don't use SSL certificate
HTTPClient https;
// Your Domain name with URL path or IP address with path
https.begin(*client, serverName);
// Specify content-type header
https.addHeader("Content-Type", "application/x-www-form-urlencoded");
// Prepare your HTTP POST request data
String httpRequestData = "api_key=" + apiKeyValue + "&sensor=" + sensorName
+ "&location=" + sensorLocation + "&value1=" + String(thermistor.read()/10) + "";
//+ "&value2=" + String(readHumidity()) + "&value3=" + String(readPressure()/100.0F) + "";
//Serial.print("httpRequestData: ");
// Serial.println(httpRequestData);
// You can comment the httpRequestData variable above
// then, use the httpRequestData variable below (for testing purposes without the BME280 sensor)
//String httpRequestData = "api_key=tPmAT5Ab3j7F9&sensor=BME280&location=Office&value1=24.75&value2=49.54&value3=1005.14";
Serial.print("httpRequestData: ");
Serial.println(httpRequestData);
// Send HTTP POST request
int httpResponseCode = https.POST(httpRequestData);
// If you need an HTTP request with a content type: text/plain
//https.addHeader("Content-Type", "text/plain");
//int httpResponseCode = https.POST("Hello, World!");
// If you need an HTTP request with a content type: application/json, use the following:
//https.addHeader("Content-Type", "application/json");
//int httpResponseCode = https.POST("{\"value1\":\"19\",\"value2\":\"67\",\"value3\":\"78\"}");
if (httpResponseCode>0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
// Free resources
https.end();
}
else {
Serial.println("WiFi Disconnected");
}
//Send an HTTP POST request every 30 seconds
delay(30000);
}
void loop(){
RequestData();
}
Waiting for experts feedback.
Thanks in advance..
Regards,
Sunil
