// the number of the LED pin
const int ledPin = 16; // 16 corresponds to GPIO16
// setting PWM properties
const int freq = 5000;
const int ledChannel = 0;
const int resolution = 8;
void setup(){
// configure LED PWM functionalitites
ledcSetup(ledChannel, freq, resolution);
// attach the channel to the GPIO to be controlled
ledcAttachPin(ledPin, ledChannel);
}
void loop(){
// increase the LED brightness
for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){
// changing the LED brightness with PWM
ledcWrite(ledChannel, dutyCycle);
delay(15);
}
// decrease the LED brightness
for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){
// changing the LED brightness with PWM
ledcWrite(ledChannel, dutyCycle);
delay(15);
}
}
Arduino: 1.8.19 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino: In function 'void setup()':
DRIVER_BRIGHTNESS:11:3: error: 'ledcSetup' was not declared in this scope
ledcSetup(ledChannel, freq, resolution);
^~~~~~~~~
DRIVER_BRIGHTNESS:14:3: error: 'ledcAttachPin' was not declared in this scope
ledcAttachPin(ledPin, ledChannel);
^~~~~~~~~~~~~
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino: In function 'void loop()':
DRIVER_BRIGHTNESS:21:5: error: 'ledcWrite' was not declared in this scope
ledcWrite(ledChannel, dutyCycle);
^~~~~~~~~
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino:21:5: note: suggested alternative: 'bitWrite'
ledcWrite(ledChannel, dutyCycle);
^~~~~~~~~
bitWrite
DRIVER_BRIGHTNESS:28:5: error: 'ledcWrite' was not declared in this scope
ledcWrite(ledChannel, dutyCycle);
^~~~~~~~~
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino:28:5: note: suggested alternative: 'bitWrite'
ledcWrite(ledChannel, dutyCycle);
^~~~~~~~~
bitWrite
exit status 1
'ledcSetup' was not declared in this scope
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\ArduinoJson: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\ArduinoJson
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\FreeRTOS-main: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\FreeRTOS-main
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\LED-Specification-sheets: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\LED-Specification-sheets
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\LedCubeTeensy-master: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\LedCubeTeensy-master
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\SPI: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\SPI
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\u8g2-master: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\u8g2-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have to control LED Strip brightness using ESP32 and I got this error can anyone help me on this
Where are ledcxxx being defined or declared ?
Probably in a missing library or support file.
It's a command no need to declare or define
you have not chosen an ESP32 - the Arduino Mega doesn't know ledcSetup. Chose the ESP32 as board and you shouldn't get this error.
Arduino: 1.8.19 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino: In function 'void setup()':
DRIVER_BRIGHTNESS:11:3: error: 'ledcSetup' was not declared in this scope
11 | ledcSetup(ledChannel, freq, resolution);
| ^~~~~~~~~
DRIVER_BRIGHTNESS:15:3: error: 'ledcAttachPin' was not declared in this scope
15 | ledcAttachPin(ledPin, ledChannel);
| ^~~~~~~~~~~~~
C:\Users\DELL\Desktop\Arduinoprojects\DRIVER_BRIGHTNESS\DRIVER_BRIGHTNESS.ino: In function 'void loop()':
DRIVER_BRIGHTNESS:22:5: error: 'ledcWrite' was not declared in this scope
22 | ledcWrite(ledChannel, dutyCycle);
| ^~~~~~~~~
DRIVER_BRIGHTNESS:29:5: error: 'ledcWrite' was not declared in this scope
29 | ledcWrite(ledChannel, dutyCycle);
| ^~~~~~~~~
exit status 1
'ledcSetup' was not declared in this scope
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\ArduinoJson: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\ArduinoJson
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\FreeRTOS-main: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\FreeRTOS-main
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\LED-Specification-sheets: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\LED-Specification-sheets
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\LedCubeTeensy-master: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\LedCubeTeensy-master
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\SPI: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\SPI
Invalid library found in C:\Users\DELL\Documents\Arduino\libraries\u8g2-master: no headers files (.h) found in C:\Users\DELL\Documents\Arduino\libraries\u8g2-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Now I have tried with Esp8266 then also I get this error
you have written you have an ESP32.
you must chose an ESP32 (not an ESP8286).
Thankyou
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.