# Please Help - Compilation error: 'ledcSetup' was not declared in this scope

**URL:** <https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382>\
**Category:** General Discussion\
**Created:** [July 19, 2024, 10:39am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382 "2024-07-19T10:39:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![IAN](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@IAN](https://forum.sunfounder.com/u/IAN)\
**Post date:** [July 19, 2024, 10:39am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/1 "2024-07-19T10:39:56Z")

</div>

I’m working through the ESP32 starter kit and it TUTs this is only the 2nd TUT  
2.2 fading LED and i can not get past this.  
I’ve followed all the steps repeatedly and this keeps happening.

C:\Users\tymed\OneDrive\Documents\ESP32\esp32-starter-kit-main\c\codes\2.2\_fading\_led\2.2\_fading\_led.ino: In function ‘void setup()’:  
C:\Users\tymed\OneDrive\Documents\ESP32\esp32-starter-kit-main\c\codes\2.2\_fading\_led\2.2\_fading\_led.ino:6:3: error: ‘ledcSetup’ was not declared in this scope  
6 | ledcSetup(0, 5000, 8); // Configure the PWM channel (0) with 5000Hz frequency and 8-bit resolution  
| ^ ~~~~~~~~  
C:\Users\tymed\OneDrive\Documents\ESP32\esp32-starter-kit-main\c\codes\2.2\_fading\_led\2.2\_fading\_led.ino:7:3: error: ‘ledcAttachPin’ was not declared in this scope; did you mean ‘ledcAttach’?  
7 | ledcAttachPin(ledPin, 0); // Attach the LED pin to the PWM channel  
| ^ ~~~~~~~~~~~~  
| ledcAttach

exit status 1

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

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [July 22, 2024, 7:31am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/2 "2024-07-22T07:31:42Z")

</div>

Please provide a screenshot of your Arduino IDE.  
And confirm that if you have selected ESP32 as the board?

---

<div class="post-metadata">

**Author:** ![IAN](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@IAN](https://forum.sunfounder.com/u/IAN)\
**Post date:** [July 22, 2024, 8:03am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/3 "2024-07-22T08:03:47Z")

</div>

Hi - yes all the previous step were followed and re-checked

 ![WhatsApp Image 2024-07-19 at 10.49.26_c9bbc6bf](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/1X/034d8bd9d9ae65ef4aa68a3f0121feb30648abef.jpeg)

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [July 23, 2024, 8:04am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/4 "2024-07-23T08:04:17Z")

</div>

The issue is being fixed by us and it will take some time to complete.  
The current solution is:  
Follow our screenshots and install ESP32, choosing version 2.0.14.

 ![image (23)](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/1X/7fe435a80fed70012e5bc69b5c4ae059716026fd.png)  
 ![image (27)](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/1X/9ff28dc1fa3f0a32310bc5b294f646b83a83cc61.png)

The installation will take a long time, so please be patient. After successful installation, you can upload the code again and see if the error message still appears.

---

<div class="post-metadata">

**Author:** ![IAN](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@IAN](https://forum.sunfounder.com/u/IAN)\
**Post date:** [July 23, 2024, 8:58am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/5 "2024-07-23T08:58:22Z")

</div>

Appreciate your reply and assistance  
Will try this

- Thanks

---

<div class="post-metadata">

**Author:** ![IAN](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@IAN](https://forum.sunfounder.com/u/IAN)\
**Post date:** [July 25, 2024, 1:16pm UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/6 "2024-07-25T13:16:27Z")

</div>

The above recommendation ESP32 - V2014 has worked - thank you

Please advise when the fix has been done

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [July 26, 2024, 7:33am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/7 "2024-07-26T07:33:12Z")

</div>

Sure.It may take three to four weeks to fix the problem.

---

<div class="post-metadata">

**Author:** ![AAAAAAAAAAAAAAAAAAAA](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@AAAAAAAAAAAAAAAAAAAA](https://forum.sunfounder.com/u/AAAAAAAAAAAAAAAAAAAA)\
**Post date:** [November 18, 2024, 11:41am UTC](https://forum.sunfounder.com/t/please-help-compilation-error-ledcsetup-was-not-declared-in-this-scope/1382/8 "2024-11-18T11:41:55Z")

</div>

very thanks bro. Fix problem change board version
