nodemcu crashes as soon as I try to access it

hello everyone,

I want to upload temperature data from a DS18B20 to a simple webpage, but everytime I try to access the page, my nodemcu crashes. I found code online and edited it a bit so it would fit my project, but I can't get it to work.

crash log: nodemcu crash log · GitHub

source code: source code temp sensor · GitHub

I hope someone can help!

Kind regards,
Sam

Line 94:

request->send_P(200, "text/plain", readDSTemperatureC().c_str());

send_P() expects a PROGMEM pointer and readDSTemperatureC().c_str() isn't.

Try:

request->send(200, "text/plain", readDSTemperatureC());

Thank you for your reply, but it sadly didn’t work.

If I just send text, it works fine.

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", "test");
  });

Do you have any another ideas?

Kind regards,
Sam

new idea: Change one single detail towards your needs.

you wrote

if I just send text, it works fine.

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){[color=#222222][/color]
    request->send_P(200, "text/plain", "test");[color=#222222][/color]
  });

As you can see at this point. Taking a big program and start to modify it requires a minimum of knowledge about programming.

the link you have posted seems to be your modified version
because there is a comment
// Replaces placeholder with DHT values

I conclude the original code was written for a DHT-sensor.
Can you please provide a link to the original code?

Or if this is the original code: does the original code work?
As anybody can upload any superbuggy code as a fork on github I would start testing the original code if the original code works at all.
The code has some ifdef statements that does change incldue-files for EPS32 or ESP8266. Maybe the code was only tested for ESP32

If the original code works then start with minimal modifcations towards your needs.

best regards Stefan