Hello.
I have a esp32 plus board. I have connected a fan. It have 4 pin IN-, IN+, V and G.
On board i have conected IN- to io18, IN+ to io19 and when i compiled a example from my smarthome kit i get a error. I use arduino ide 2.3.4. I have tested with another analogwrite libraries but it doesnt words.
This is code:
c:\Users\Pepe\Documents\Arduino\libraries\ESP32_AnalogWrite\analogWrite.cpp: In function 'int analogWriteChannel(uint8_t)':
c:\Users\Pepe\Documents\Arduino\libraries\ESP32_AnalogWrite\analogWrite.cpp:44:9: error: 'ledcSetup' was not declared in this scope
44 | ledcSetup(channel, _analog_write_channels[i].frequency, _analog_write_channels[i].resolution);
| ^~~~~~~~~
c:\Users\Pepe\Documents\Arduino\libraries\ESP32_AnalogWrite\analogWrite.cpp:45:9: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
45 | ledcAttachPin(pin, channel);
| ^~~~~~~~~~~~~
| ledcAttach
However, this isn't a problem because the "esp32" platform's core now provides an analogWrite function. So you don't need to use the ESP32_AnalogWrite library anymore.
So just delete this line from your sketch:
Then try compiling or uploading again. This time there should not be any error.
Sounds like you're the victim of the change in the ESP32 boards package from version 2.x to 3.x. And the analogWrite library that you're using is not compatible with that change; any reason to use a specific library?
Your code compiles with ESP32 board package 3.1.0 for and ESP32 Dev module (I do not know which board you have selected, I could not find a ESP32 plus) if you remove the line #include <analogWrite.h>.
Thanks a lot. Now it works if i don't use analogwrite.h library. I have use a code from example of my smarthome kit ks5009.
It is incredible that there are these errors in the manufacturer's own code.
Regards