Asked

Programming Esp32 As An Ezb

I'm having trouble creating an EZ-B from an esp32.  I know I've successfully done it in the past about a year ago - but now when I try I'm getting these error messages: C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In destructor 'virtual ESP32PWM::~ESP32PWM()': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:50:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'? 50 | ledcDetachPin(pin); | ^~~~~~~~~~~~~ | ledcDetach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In static member function 'static double ESP32PWM::_ledcSetupTimerFreq(uint8_t, double, uint8_t)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:57:16: error: 'ledcSetup' was not declared in this scope 57 | return ledcSetup(chan, freq, bit_num); | ^~~~~~~~~ C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In member function 'double ESP32PWM::setup(double, uint8_t)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:148:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'? 148 | ledcDetachPin(pin); | ^~~~~~~~~~~~~ | ledcDetach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:149:30: error: 'ledcSetup' was not declared in this scope 149 | double val = ledcSetup(getChannel(), freq, resolution_bits); | ^~~~~~~~~ C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:153:16: error: 'ledcSetup' was not declared in this scope 153 | return ledcSetup(getChannel(), freq, resolution_bits); | ^~~~~~~~~ C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In member function 'void ESP32PWM::adjustFrequencyLocal(double, float)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:170:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'? 170 | ledcDetachPin(pin); | ^~~~~~~~~~~~~ | ledcDetach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:174:17: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'? 174 | ledcAttachPin(pin, getChannel()); // re-attach the pin after frequency adjust | ^~~~~~~~~~~~~ | ledcAttach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In member function 'void ESP32PWM::attachPin(uint8_t)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:235:17: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'? 235 | ledcAttachPin(pin, getChannel()); | ^~~~~~~~~~~~~ | ledcAttach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp: In member function 'void ESP32PWM::detachPin(int)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\ESP32PWM.cpp:251:9: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'? 251 | ledcDetachPin(pin); | ^~~~~~~~~~~~~ | ledcDetach C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino: In function 'void WiFiEvent(arduino_event_id_t)': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:219:10: error: 'SYSTEM_EVENT_WIFI_READY' was not declared in this scope; did you mean 'WIFI_EVENT_WIFI_READY'? 219 | case SYSTEM_EVENT_WIFI_READY: | ^~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_WIFI_READY C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:222:10: error: 'SYSTEM_EVENT_SCAN_DONE' was not declared in this scope; did you mean 'SC_EVENT_SCAN_DONE'? 222 | case SYSTEM_EVENT_SCAN_DONE: | ^~~~~~~~~~~~~~~~~~~~~~ | SC_EVENT_SCAN_DONE C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:225:10: error: 'SYSTEM_EVENT_STA_START' was not declared in this scope; did you mean 'WIFI_EVENT_STA_START'? 225 | case SYSTEM_EVENT_STA_START: | ^~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_START C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:228:10: error: 'SYSTEM_EVENT_STA_STOP' was not declared in this scope; did you mean 'WIFI_EVENT_STA_STOP'? 228 | case SYSTEM_EVENT_STA_STOP: | ^~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_STOP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:231:10: error: 'SYSTEM_EVENT_STA_CONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_CONNECTED'? 231 | case SYSTEM_EVENT_STA_CONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_CONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:234:10: error: 'SYSTEM_EVENT_STA_DISCONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_DISCONNECTED'? 234 | case SYSTEM_EVENT_STA_DISCONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_DISCONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:237:10: error: 'SYSTEM_EVENT_STA_AUTHMODE_CHANGE' was not declared in this scope; did you mean 'WIFI_EVENT_STA_AUTHMODE_CHANGE'? 237 | case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_AUTHMODE_CHANGE C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:240:10: error: 'SYSTEM_EVENT_STA_GOT_IP' was not declared in this scope; did you mean 'IP_EVENT_STA_GOT_IP'? 240 | case SYSTEM_EVENT_STA_GOT_IP: | ^~~~~~~~~~~~~~~~~~~~~~~ | IP_EVENT_STA_GOT_IP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:244:10: error: 'SYSTEM_EVENT_STA_LOST_IP' was not declared in this scope; did you mean 'IP_EVENT_STA_LOST_IP'? 244 | case SYSTEM_EVENT_STA_LOST_IP: | ^~~~~~~~~~~~~~~~~~~~~~~~ | IP_EVENT_STA_LOST_IP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:247:10: error: 'SYSTEM_EVENT_STA_WPS_ER_SUCCESS' was not declared in this scope; did you mean 'WIFI_EVENT_STA_WPS_ER_SUCCESS'? 247 | case SYSTEM_EVENT_STA_WPS_ER_SUCCESS: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_WPS_ER_SUCCESS C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:250:10: error: 'SYSTEM_EVENT_STA_WPS_ER_FAILED' was not declared in this scope; did you mean 'WIFI_EVENT_STA_WPS_ER_FAILED'? 250 | case SYSTEM_EVENT_STA_WPS_ER_FAILED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_WPS_ER_FAILED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:253:10: error: 'SYSTEM_EVENT_STA_WPS_ER_TIMEOUT' was not declared in this scope; did you mean 'WIFI_EVENT_STA_WPS_ER_TIMEOUT'? 253 | case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_WPS_ER_TIMEOUT C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:256:10: error: 'SYSTEM_EVENT_STA_WPS_ER_PIN' was not declared in this scope; did you mean 'WIFI_EVENT_STA_WPS_ER_PIN'? 256 | case SYSTEM_EVENT_STA_WPS_ER_PIN: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_STA_WPS_ER_PIN C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:259:10: error: 'SYSTEM_EVENT_AP_START' was not declared in this scope; did you mean 'WIFI_EVENT_AP_START'? 259 | case SYSTEM_EVENT_AP_START: | ^~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_AP_START C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:262:10: error: 'SYSTEM_EVENT_AP_STOP' was not declared in this scope; did you mean 'WIFI_EVENT_AP_STOP'? 262 | case SYSTEM_EVENT_AP_STOP: | ^~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_AP_STOP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:265:10: error: 'SYSTEM_EVENT_AP_STACONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_AP_STACONNECTED'? 265 | case SYSTEM_EVENT_AP_STACONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_AP_STACONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:268:10: error: 'SYSTEM_EVENT_AP_STADISCONNECTED' was not declared in this scope; did you mean 'WIFI_EVENT_AP_STADISCONNECTED'? 268 | case SYSTEM_EVENT_AP_STADISCONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_AP_STADISCONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:271:10: error: 'SYSTEM_EVENT_AP_STAIPASSIGNED' was not declared in this scope; did you mean 'IP_EVENT_AP_STAIPASSIGNED'? 271 | case SYSTEM_EVENT_AP_STAIPASSIGNED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | IP_EVENT_AP_STAIPASSIGNED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:274:10: error: 'SYSTEM_EVENT_AP_PROBEREQRECVED' was not declared in this scope; did you mean 'WIFI_EVENT_AP_PROBEREQRECVED'? 274 | case SYSTEM_EVENT_AP_PROBEREQRECVED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | WIFI_EVENT_AP_PROBEREQRECVED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:277:10: error: 'SYSTEM_EVENT_GOT_IP6' was not declared in this scope; did you mean 'IP_EVENT_GOT_IP6'? 277 | case SYSTEM_EVENT_GOT_IP6: | ^~~~~~~~~~~~~~~~~~~~ | IP_EVENT_GOT_IP6 C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:280:10: error: 'SYSTEM_EVENT_ETH_START' was not declared in this scope; did you mean 'ARDUINO_EVENT_ETH_START'? 280 | case SYSTEM_EVENT_ETH_START: | ^~~~~~~~~~~~~~~~~~~~~~ | ARDUINO_EVENT_ETH_START C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:283:10: error: 'SYSTEM_EVENT_ETH_STOP' was not declared in this scope; did you mean 'ARDUINO_EVENT_ETH_STOP'? 283 | case SYSTEM_EVENT_ETH_STOP: | ^~~~~~~~~~~~~~~~~~~~~ | ARDUINO_EVENT_ETH_STOP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:286:10: error: 'SYSTEM_EVENT_ETH_CONNECTED' was not declared in this scope; did you mean 'ARDUINO_EVENT_ETH_CONNECTED'? 286 | case SYSTEM_EVENT_ETH_CONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | ARDUINO_EVENT_ETH_CONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:289:10: error: 'SYSTEM_EVENT_ETH_DISCONNECTED' was not declared in this scope; did you mean 'ARDUINO_EVENT_ETH_DISCONNECTED'? 289 | case SYSTEM_EVENT_ETH_DISCONNECTED: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ARDUINO_EVENT_ETH_DISCONNECTED C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:292:10: error: 'SYSTEM_EVENT_ETH_GOT_IP' was not declared in this scope; did you mean 'IP_EVENT_ETH_GOT_IP'? 292 | case SYSTEM_EVENT_ETH_GOT_IP: | ^~~~~~~~~~~~~~~~~~~~~~~ | IP_EVENT_ETH_GOT_IP C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino: In function 'void doEZProtocol()': C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:591:18: error: call of overloaded 'analogWrite(byte, long int)' is ambiguous 591 | analogWrite(translateaDigitalPort(port), map(pos, 0, 100, 0, 255)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from C:\Users\dream\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\cores\esp32/Arduino.h:36, from C:\Users\dream\AppData\Local\Temp\arduino\sketches\C361AE333B3D859307E5B47E4903DBBE\sketch\EZ-ESP32.ino.cpp:1: C:\Users\dream\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\cores\esp32/esp32-hal.h:90:6: note: candidate: 'void analogWrite(uint8_t, int)' 90 | void analogWrite(uint8_t pin, int value); | ^~~~~~~~~~~ In file included from C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\EZ-ESP32.ino:9: C:\Users\dream\Downloads\EZ-ESP32 (1)\EZ-ESP32\analogWrite.h:9:8: note: candidate: 'void analogWrite(uint8_t, uint16_t)' 9 | void analogWrite( uint8_t APin, uint16_t AValue ); | ^~~~~~~~~~~

exit status 1

Compilation error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?



ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

#1   — Edited

@athena please answer the question

note: have moved your question from an unrelated thread to this new question post.

PRO
Canada
#2  

It looks like you're encountering several issues related to the ESP32 firmware and the Arduino IDE. These errors are likely due to changes in the ESP32 libraries or the Arduino core since you last successfully compiled the firmware. Let's address these issues step by step.

1. Update ESP32 Libraries and Core

First, ensure that you have the latest ESP32 libraries and core installed in your Arduino IDE. You can do this by following these steps:

  1. Open the Arduino IDE.
  2. Go to File > Preferences.
  3. In the "Additional Boards Manager URLs" field, add the following URL if it's not already there:
    https://dl.espressif.com/dl/package_esp32_index.json
    
  4. Go to Tools > Board > Boards Manager.
  5. Search for "ESP32" and install the latest version.

2. Update the Firmware Code

The errors you're encountering suggest that some functions and constants have been renamed or deprecated. Here are the specific changes you need to make:

ESP32PWM.cpp

Replace all instances of ledcDetachPin with ledcDetach and ledcAttachPin with ledcAttach.

WiFiEvent Function

Replace all instances of SYSTEM_EVENT_* with their corresponding WIFI_EVENT_* or IP_EVENT_* constants. Here is a mapping for the changes:

  • SYSTEM_EVENT_WIFI_READY -> WIFI_EVENT_WIFI_READY
  • SYSTEM_EVENT_SCAN_DONE -> SC_EVENT_SCAN_DONE
  • SYSTEM_EVENT_STA_START -> WIFI_EVENT_STA_START
  • SYSTEM_EVENT_STA_STOP -> WIFI_EVENT_STA_STOP
  • SYSTEM_EVENT_STA_CONNECTED -> WIFI_EVENT_STA_CONNECTED
  • SYSTEM_EVENT_STA_DISCONNECTED -> WIFI_EVENT_STA_DISCONNECTED
  • SYSTEM_EVENT_STA_AUTHMODE_CHANGE -> WIFI_EVENT_STA_AUTHMODE_CHANGE
  • SYSTEM_EVENT_STA_GOT_IP -> IP_EVENT_STA_GOT_IP
  • SYSTEM_EVENT_STA_LOST_IP -> IP_EVENT_STA_LOST_IP
  • SYSTEM_EVENT_STA_WPS_ER_SUCCESS -> WIFI_EVENT_STA_WPS_ER_SUCCESS
  • SYSTEM_EVENT_STA_WPS_ER_FAILED -> WIFI_EVENT_STA_WPS_ER_FAILED
  • SYSTEM_EVENT_STA_WPS_ER_TIMEOUT -> WIFI_EVENT_STA_WPS_ER_TIMEOUT
  • SYSTEM_EVENT_STA_WPS_ER_PIN -> WIFI_EVENT_STA_WPS_ER_PIN
  • SYSTEM_EVENT_AP_START -> WIFI_EVENT_AP_START
  • SYSTEM_EVENT_AP_STOP -> WIFI_EVENT_AP_STOP
  • SYSTEM_EVENT_AP_STACONNECTED -> WIFI_EVENT_AP_STACONNECTED
  • SYSTEM_EVENT_AP_STADISCONNECTED -> WIFI_EVENT_AP_STADISCONNECTED
  • SYSTEM_EVENT_AP_STAIPASSIGNED -> IP_EVENT_AP_STAIPASSIGNED
  • SYSTEM_EVENT_AP_PROBEREQRECVED -> WIFI_EVENT_AP_PROBEREQRECVED
  • SYSTEM_EVENT_GOT_IP6 -> IP_EVENT_GOT_IP6
  • SYSTEM_EVENT_ETH_START -> ARDUINO_EVENT_ETH_START
  • SYSTEM_EVENT_ETH_STOP -> ARDUINO_EVENT_ETH_STOP
  • SYSTEM_EVENT_ETH_CONNECTED -> ARDUINO_EVENT_ETH_CONNECTED
  • SYSTEM_EVENT_ETH_DISCONNECTED -> ARDUINO_EVENT_ETH_DISCONNECTED
  • SYSTEM_EVENT_ETH_GOT_IP -> IP_EVENT_ETH_GOT_IP

analogWrite Function

The error call of overloaded 'analogWrite(byte, long int)' is ambiguous suggests that there are multiple definitions of analogWrite. Ensure that you are using the correct definition. You might need to cast the value to the appropriate type.

Replace:

analogWrite(translateaDigitalPort(port), map(pos, 0, 100, 0, 255));

With:

analogWrite(translateaDigitalPort(port), (int)map(pos, 0, 100, 0, 255));

3. Recompile the Firmware

After making these changes, try recompiling the firmware. If you encounter any further issues, please provide the updated error messages, and we can continue troubleshooting from there.

Summary of Changes

  1. Update ESP32 libraries and core in Arduino IDE.
  2. Replace ledcDetachPin with ledcDetach and ledcAttachPin with ledcAttach.
  3. Replace SYSTEM_EVENT_* constants with their corresponding WIFI_EVENT_* or IP_EVENT_* constants.
  4. Cast the value in the analogWrite function to int.

By following these steps, you should be able to resolve the compilation errors and successfully create an EZ-B from your ESP32. If you need further assistance, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#3  

i updated the board definitions, libraries, and code based on your suggestions and am still getting errors.  i'll upload the new code in this message also EZ-ESP32_Updated.zip