I have problem with getting PC PWM fans to work with ESPHome. I have working application written in Arduino cpp and I’m trying to convert it into ESPHome. But with ESPHome code fans are not slowing or speeding up. When I set speed variable to 0-99 they spin at some “default” unknown speed. When I set 100 they are spinning at full speed. Can somebody help me please how to make it work just like Arduino code?
This is working Arduino code:
pinMode(D1, OUTPUT);
analogWriteRange(100);
analogWriteFreq(25000);
analogWrite(D1, speed); // speed is in range of 0 - 100
@koying I think you are right and this would be solution! Just tested in simulator: sketch.ino - Wokwi Arduino Simulator
I’m used to program in C# so I was blind for this kind of “simple mistake”. And in my original Arduino code I’m not dividing speed value because PWM output is in 0-100 range instead of ESPHomes 0.0-1.0
Thanks everyone for giving advices. I’ll try everything when I’ll be at home at evening and let you know!