Comments on: ESP32 PWM with Arduino IDE (Analog Output) https://randomnerdtutorials.com/esp32-pwm-arduino-ide/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Sun, 01 Jun 2025 10:10:48 +0000 hourly 1 https://wordpress.org/?v=6.8.1 By: Sara Santos https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-1052983 Sun, 01 Jun 2025 10:10:48 +0000 https://randomnerdtutorials.com/?p=75663#comment-1052983 In reply to alex.

Hi.
Update your ESP32 boards to version 3.
Go to Tools > Boards > Boards Manager > Search for ESP32, and update to version 3.
Regards,
Sara

]]>
By: alex https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-1052328 Fri, 30 May 2025 10:29:14 +0000 https://randomnerdtutorials.com/?p=75663#comment-1052328 PLEASE HELP ME
Error :

C:\Users\intel\Downloads\xe_tranh_vat_can_Arduino\xe_tranh_vat_can_Arduino.ino: In function ‘void setup()’:
C:\Users\intel\Downloads\xe_tranh_vat_can_Arduino\xe_tranh_vat_can_Arduino.ino:17:3: error: ‘ledcAttach’ was not declared in this scope
ledcAttach(ledPin, freq, resolution);
^~~~~~~~~~
C:\Users\intel\Downloads\xe_tranh_vat_can_Arduino\xe_tranh_vat_can_Arduino.ino:17:3: note: suggested alternative: ‘ledcAttachPin’
ledcAttach(ledPin, freq, resolution);
^~~~~~~~~~
ledcAttachPin
exit status 1

Compilation error: ‘ledcAttach’ was not declared in this scope

]]>
By: SébaSAUV https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-1004521 Sun, 02 Feb 2025 01:07:11 +0000 https://randomnerdtutorials.com/?p=75663#comment-1004521 it is necessary to select 16-bit resolution

]]>
By: SébaSAUV https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-1004514 Sun, 02 Feb 2025 00:12:14 +0000 https://randomnerdtutorials.com/?p=75663#comment-1004514 Hello everyone,
I’m trying to generate a 1Hz PWM signal with a 97.5% duty cycle. I can’t do it with these functions. Do you have any ideas, please?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-987231 Thu, 28 Nov 2024 10:47:25 +0000 https://randomnerdtutorials.com/?p=75663#comment-987231 In reply to Rick.

That’s great.
I’m glad it’s working now.
Regards,
Sara

]]>
By: Rick https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-987167 Thu, 28 Nov 2024 01:55:27 +0000 https://randomnerdtutorials.com/?p=75663#comment-987167 Hi Sara,
Thanks for a quick response. I followed your suggestion and it worked no compiling or issues whatsoever.
Now my project is incorporating the PS3 controller to this Tutorial.
Thanks again
Rick

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-987039 Wed, 27 Nov 2024 11:02:20 +0000 https://randomnerdtutorials.com/?p=75663#comment-987039 In reply to Ricardo.

Hi.
It seems you already have the latest version.
Uninstall the Arduino ESP32 Boards 2.0.18 and the one by Ricardo Quesada. You only need the one by expressif.
Additionally, make sure that you have an ESP32 board selected in Tools > Board when trying to compile an ESP32 code.

Regards,
Sara

]]>
By: Ricardo https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-986939 Tue, 26 Nov 2024 23:49:14 +0000 https://randomnerdtutorials.com/?p=75663#comment-986939 Hi Sara,
Thanks for a quick response. I just want to clarify the ESP32 boards you said I’m using version 2. How do I update to version 3. Currently my ESP32 boards on my library installed is Arduino ESP32 Boards 2.0.18 and ESP32 by Expressif Systems is version 3.07 both installed.
Where do I get the version 3 of ESP32 boards you’re suggesting. Sorry I’m just new to this libraries.
I got this information from my Arduino IDE by typing on my boards manager ESP32 and it populates my boards to 3 boards. Two I mentioned above and the 3rd one is esp32_bluepad32 by Ricardo Quesada.
Thanks
Rick

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-986716 Tue, 26 Nov 2024 14:45:36 +0000 https://randomnerdtutorials.com/?p=75663#comment-986716 In reply to Rick Balazo.

Hi.
Please update your ESP32 boards installation to version 3.
The PWM methods have changed. You must still be running ESP32 version 2.
Let me know if you can solve the issue.
Regards,
Sara

]]>
By: Rick Balazo https://randomnerdtutorials.com/esp32-pwm-arduino-ide/#comment-986544 Tue, 26 Nov 2024 02:25:45 +0000 https://randomnerdtutorials.com/?p=75663#comment-986544 Hi Sara,

Thanks for this code works fine in my ESP 32 Dev Module. However I tried using the code in an RGB using “ledcAttachChannel(ledPin, freq, resolution, 0);” controlled by a PS3 controller. However compiler does’nt agree with it, getting an error message below,

C:\Users\Admin\Documents\Arduino\sketch_nov23b_PS3Controller_RGB\sketch_nov23b_PS3Controller_RGB.ino: In function ‘void setup()’:
C:\Users\Admin\Documents\Arduino\sketch_nov23b_PS3Controller_RGB\sketch_nov23b_PS3Controller_RGB.ino:98:20: error: too few arguments to function ‘bool ledcAttachChannel(uint8_t, uint32_t, uint8_t, uint8_t)’
98 | ledcAttachChannel(redChannel, ledFreq, ledResolution);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal.h:81,
from C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/Arduino.h:36,
from C:\Users\Admin\AppData\Local\Temp\arduino\sketches\8477042612A4719C5780DF660271FDF4\sketch\sketch_nov23b_PS3Controller_RGB.ino.cpp:1:
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-ledc.h:99:6: note: declared here
99 | bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel);
| ^~~~~~~~~~~~~~~~~
C:\Users\Admin\Documents\Arduino\sketch_nov23b_PS3Controller_RGB\sketch_nov23b_PS3Controller_RGB.ino:99:20: error: too few arguments to function ‘bool ledcAttachChannel(uint8_t, uint32_t, uint8_t, uint8_t)’
99 | ledcAttachChannel(greenChannel, ledFreq, ledResolution);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-ledc.h:99:6: note: declared here
99 | bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel);
| ^~~~~~~~~~~~~~~~~
C:\Users\Admin\Documents\Arduino\sketch_nov23b_PS3Controller_RGB\sketch_nov23b_PS3Controller_RGB.ino:100:20: error: too few arguments to function ‘bool ledcAttachChannel(uint8_t, uint32_t, uint8_t, uint8_t)’
100 | ledcAttachChannel(blueChannel, ledFreq, ledResolution);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-ledc.h:99:6: note: declared here
99 | bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel);
| ^~~~~~~~~~~~~~~~~
C:\Users\Admin\Documents\Arduino\sketch_nov23b_PS3Controller_RGB\sketch_nov23b_PS3Controller_RGB.ino:104:3: error: ‘ledcAttachpin’ was not declared in this scope; did you mean ‘ledcAttach’?
104 | ledcAttachpin(ledRed, redChannel);
| ^~~~~~~~~~~~~
| ledcAttach

exit status 1

Compilation error: too few arguments to function ‘bool ledcAttachChannel(uint8_t, uint32_t, uint8_t, uint8_t)’

I’m just learning these ESP32 because I have a project using a PS3 controller via bluetooth to control an RC car. Currently I’m just using PS3 controller to turn on/off led lights and its working. However I’m still trying to find out how I can get a code to control an rc car using PS3 controller and ESP32.
I have been successfull using a phone app and a web page controlling an rc car.
However incorporating a PS3 controller and ESP32 to control an RC car(using L298N motor driver for the dc motor wheels) is tough currently.
I hope you can help me.
Thanks
Rick

]]>