Getting Guru Meditation Error when using DallasTemperature with Wifi.h on esp32

  arduino-ide, c++, esp

I’m getting this error, when trying to use Wifi + DallasTemperature on my esp32.
Temperature sensor is Gravity DS18B20.
When I comment this line

connectToWiFi();

it works fine.

enter image description here

here is my code

#include <OneWire.h>
#include <DallasTemperature.h>
#include <WiFi.h>


// Wifi Settings
#define WIFI_NETWORK "name"
#define WIFI_PASSWORD "pass"
#define WIFI_TIMOUT_MS 20000

const int oneWireBus = 32;
OneWire oneWire(oneWireBus);
DallasTemperature sensors(&oneWire);
int status;



int connectToWiFi() {
    Serial.println(" ");
    Serial.print("Connencting to WiFi");
    Serial.print(" ");
    WiFi.mode(WIFI_STA);
    WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);

    unsigned long startAttemptTime = millis();

    while(WiFi.status() != WL_CONNECTED && millis() - startAttemptTime < WIFI_TIMOUT_MS) {
        Serial.print(".");
        delay(700);
    }

    if (WiFi.status() != WL_CONNECTED) {
        Serial.println("Failed connect to WiFi!");
        return 0;

    }

    else {
        Serial.print("Connected to WiFi");
        Serial.println(WIFI_NETWORK);
        Serial.println(WiFi.localIP());
        return 1;
    }
}


void setup() {
    status = connectToWiFi();
    Serial.begin(115200);
    sensors.begin();


void loop() {
        
}

Source: Windows Questions C++

LEAVE A COMMENT