Wemos D1+ MQTT pwm fan speed

there are a lot of tutorial on L298 driver on internet and most recomended. so see if you can buy one and they are not expensive also.

Ok. can you check my code too?

looks fine. In your serial can you read the slider value?

yes

The code working :slight_smile:
Just the hardware hava something wrong

Need a little more help :slight_smile:

I can manage the output V, but not too correct.
Here is my code:
CAYENNE_IN(11)
{
int currentValue = getValue.asInt(); // 0 to 255
int value2= map(currentValue , 0, 100, 0, 1023);
analogWrite(PWM_DIGITAL_PIN2, value2);
}

I make slider widget 0-100 value and 10 step value.
I measure the follow:
slider 0% output 0V
10% 0V
20% 0,7V
30% 2,3V
40% 3,9V
50% 6,2V
60% 8,3V
70% 10,8V
80% 13,3V
90% 16,4V
100% 23,8V

What need to fix in the code to make same value?
Or if i want 0-24 slider, then 0=,1=1V,2=2Vā€¦ etc

so if slider is 24 do you want 24v from arduino. which is not possible.
analogWrite takes value between 0 to 255 where 0 is full speed and 255 is full speed.

so add a slider with 0 as min and 10 as max and int x =map(value, 0 ,10, 0, 255) and write x to pwm pin using a analogWrite.

it doesnt work.
I got the full speed(3.3V) if i add 1023, not 255