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:
#include <analogWrite.h>
#define fanPin1 19
#define fanPin2 18
void setup() {
pinMode(fanPin1, OUTPUT);
pinMode(fanPin2, OUTPUT);
}
void loop() {
digitalWrite(fanPin1, LOW); //pwm = 0
analogWrite(fanPin2, 180);
delay(3000);
digitalWrite(fanPin1, LOW);
digitalWrite(fanPin2, LOW);
delay(1000);
digitalWrite(fanPin1, HIGH); //pwm = 255
analogWrite(fanPin2, 210);
delay(3000);
digitalWrite(fanPin1, LOW);
digitalWrite(fanPin2, LOW);
delay(1000);
}
And this is error i get:
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
exit status 1
Compilation error: exit status 1
Can you help me?
Thanks.
