Arduino, esp-01 and display 16x2

wvmarle:
Reset cause 4 is a wdt reset. So something in your program is stuck.
Most likely there's an error in your ESP code - and it's almost certainly in the parts you didn't post.

void setup() {

  analogWrite(8, Contrast);
  lcd.begin(16,2);
  
  Serial.begin(115200);
  Serial.println("Starting");

}



void loop () {
  
  lcd.setCursor(0,0);
  lcd.print("ghfgh");
       delay(500);

  Serial.println("Starting");

  
}

I removed my code, and only left this inside and it still doesn't work. Running on esp8266 generic board. It's the same error as above

Juraj:
you combined an Arduino sketch with an esp sketch?

Can't i do that ?

wvmarle:
You probably got a stack trace with that as well.
Install the ESP exception decoder to the Arduino IDE to decode what it says, at times there's useful information to be found there.

A "wdt reset" means the device is stuck - but it being stuck may be both the cause or the result of the error.

I will try it, thx.