ESP32 By Espressif Systems fault

I wrote a simple code

int ledpin = 12;
int freq = 5000;
int ledch = 0;
int reso = 8;
void setup() {
ledcSetup(ledch,freq,reso);
ledcAttachPin(ledpin,ledch);
}
void loop() {
ledcWrite (ledch,50);

delay(500);
ledcWrite (ledch,100);
delay(500);
ledcWrite (ledch,150);
delay(500);
ledcWrite (ledch,200);
delay(500);
ledcWrite (ledch,255);
delay(500);
}

and after I had this fault


C:\Users\mehran\AppData\Local\Temp\.arduinoIDE-unsaved202518-24052-pukeqe.fsmf\sketch_feb8a\sketch_feb8a.ino: In function 'void setup()':
C:\Users\mehran\AppData\Local\Temp\.arduinoIDE-unsaved202518-24052-pukeqe.fsmf\sketch_feb8a\sketch_feb8a.ino:7:1: error: 'ledcSetup' was not declared in this scope
    7 | ledcSetup(ledch,freq,reso);
      | ^~~~~~~~~
C:\Users\mehran\AppData\Local\Temp\.arduinoIDE-unsaved202518-24052-pukeqe.fsmf\sketch_feb8a\sketch_feb8a.ino:8:1: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
    8 | ledcAttachPin(ledpin,ledch);
      | ^~~~~~~~~~~~~
      | ledcAttach

exit status 1

Compilation error: 'ledcSetup' was not declared in this scope

Can someone help me with this problem

Welcome to the forum

Which version of the ESP32 board files are you using ?

I ask because some recent versions have changes that affect ledc functionality. Try reverting to an earlier version of the board files

Alternatively, search the forum for the error message

I am using ESP32 DEV Module

It was the version 3 changes that caused problems. Search the forum for the error message that you got and you will find multiple reports of the problem

See Migration from 2.x to 3.0 - - — Arduino ESP32 latest documentation