• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 Web Server – Arduino IDE won't build using VSC – 'ledcAttachChannel' was not declared in this scope

Q&A Forum › Category: ESP32 › ESP32 Web Server – Arduino IDE won't build using VSC – 'ledcAttachChannel' was not declared in this scope
0 Vote Up Vote Down
Steve Gale asked 1 year ago

Hi,
If I follow the above tutorial and use the Arduino IDE the project builds.
 
However, I am trying to do everything using VSC because I use ESP devices, raspbery PI and PICO.
When I try and build the project in VSC I get the error
‘ledcAttachChannel’ was not declared in this scope
Looking on the internet one fix is to use
‘ledcAttach’ instead.
However, this generates a similar error.
Could this be becuse I am using a later version of Arduino.h than the tutorial?
 
My platformio.ini file is

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps = ESP Async WebServer
    arduino-libraries/Arduino_JSON @ 0.1.0
board_build.filesystem = littlefs

Before attemtping this tutorial I managed to build and run the littleFS example where a file is read and the data output to the serial monitor.
So I have some confidence in my Arduino set up.
 
cheers
 
Steve Gale

Question Tags: Arduino VSC
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
You need to update your ESP32 boards in PlatformIO to use the latest version of the Arduino core, version 3.
Go to Home > Platforms, then click on the Updates tab at the top, and then update espressif32.
 
Let me know if this solves the issue.
Regards,
Sara

0 Vote Up Vote Down
Steve Gale answered 1 year ago

Hi,
Thanks for quick response.
Under platforms I do not have any options to update.
espressif32 is version 6.7
 
cheers
 
Steve

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
It seems that platformIO doesn’t update to the latest core automatically.
After searching and testing for a while I found out that you need to include the following on your paltformio.ini file so that it uses core 3.0

platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip

This works for me.
Let me know if this solves your issue.

Regards,
Sara

0 Vote Up Vote Down
Steve Gale answered 1 year ago

That fixed it, brilliant, thanks for help.
 
You obviously know what to search for 🙂
 
Steve

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

That’s great.
I’m glad it’s working.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.