adafruit/Adafruit_TCS34725

Guru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was unhandled.

Closed this issue · 2 comments

Hi, I am doing a final year project which is a weather station Web with DHT22 sensor for temperature and humidity and pressure with BMP180 sensor all on the Huzzah ESP32 I need help because when a client connects to the server the monitor shows this error and the ESP32 restarts:

Guru Meditation Error: Core 1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC : 0x40147ec1 PS : 0x00060830 A0 : 0x800d1430 A1 : 0x3ffcf740
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000002 A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffcf720
A10 : 0x00ffffff A11 : 0x000000f8 A12 : 0x3ffc18b0 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000005 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x40147ec1:0x3ffcf740 0x400d142d:0x3ffcf760 0x400d0c7a:0x3ffcf780 0x400d0d03:0x3ffcf7b0 0x40147d4d:0x3ffcf7d0 0x400d6858:0x3ffcf7f0 0x400d6ae1:0x3ffcf880 0x400d56fa:0x3ffcf8d0 0x400d423a:0x3ffcf910 0x400d4c41:0x3ffcf950 0x400d0a4f:0x3ffcf990 0x400d6f29:0x3ffcf9d0 0x400d4e05:0x3ffcfa20 0x400d4ec9:0x3ffcfa60 0x400d5119:0x3ffcfab0 0x400d7fa5:0x3ffcfad0 0x400d8021:0x3ffcfb10 0x400d85fe:0x3ffcfb30 0x4008a02e:0x3ffcfb60

Rebooting...

If you could help me because it is very urgent please.

hi your code isnt using this driver at all. if you need project help - post in adafruit forums or some other project support forum.

This is the arduino code:

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include "WiFi.h"
#include "ESPAsyncWebServer.h"
#include <Adafruit_Sensor.h>
#include <DHT.h>

Adafruit_BMP085 bmp;

const char* ssid = "iPhone de Mouya";
const char* password = "1234567890";

#define DHTPIN 27
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

AsyncWebServer server(80);

String readDHTTemperature() {
float t = dht.readTemperature();
if (isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return "--";
}
else {
Serial.println(t);
return String(t);
}
}

String readDHTHumidity() {
float h = dht.readHumidity();
if (isnan(h)) {
Serial.println("Failed to read from DHT sensor!");
return "--";
}
else {
Serial.println(h);
return String(h);
}
}

String readBMPPressure() {
float p = bmp.readPressure();
if (isnan(p)) {
Serial.println("Failed to read from BMP180 sensor!");
return "--";
}
else {
Serial.println(p);
return String(p);
}
}

const char index_html[] PROGMEM = R"rawliteral(

<style> html { font-family: Arial; display: inline-block; margin: 0px auto; text-align: center; } h2 { font-size: 3.0rem; } p { font-size: 3.0rem; } .units { font-size: 1.2rem; } .dht-labels{ font-size: 1.5rem; vertical-align:middle; padding-bottom: 15px; } </style>

Raspidomo

Temperature %TEMPERATURE% °C

Humidite %HUMIDITY% %

Pression %PRESSURE% Pa

<script> setInterval(function ( ) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("temperature").innerHTML = this.responseText; } }; xhttp.open("GET", "/temperature", true); xhttp.send(); }, 10000 ) ;

setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("humidity").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/humidity", true);
xhttp.send();
}, 10000 ) ;

</script> )rawliteral";

// Replaces placeholder with DHT values
String processor(const String& var){
//Serial.println(var);
if(var == "TEMPERATURE"){
return readDHTTemperature();
}
else if(var == "HUMIDITY"){
return readDHTHumidity();
}
else if(var == "PRESSURE"){
return readBMPPressure();
}
return String();
}

void setup(){
// Serial port for debugging purposes
Serial.begin(115200);

dht.begin();
bmp.begin();

// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}

// Print ESP32 Local IP Address
Serial.println(WiFi.localIP());

// Route for root / web page
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html, processor);
});
server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", readDHTTemperature().c_str());
});
server.on("/humidity", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", readDHTHumidity().c_str());
});
server.on("/pressure", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", readBMPPressure().c_str());
});

// Start server
server.begin();
}

void loop(){

}