I just got a Wifi Arduino car and put in NodeMCU esp8266 …
Controlling it both web page and C# speech say forward it moves forward, but I can not get analogWrite() function to adjust the speed by PWM …
I have read may tutorials. each, when applied failed. Any ideas or different H-Brigde?
As I’ve told you the duty cycle range for the PWM of the ESP8266 is 0 to 1023.
However, when controlling the motor, low duty cycles values may result in a weird buzz sound, and the motor won’t move.
You need to experiment and see what is the lowest value that makes the motor move.
If you experiment higher duty cycles, the motor will probably move.
For example, try:
Then, let me know the results.
I’ve experimented with the L298N driver with an ESP32, and it worked fine to adjust the speed. So, I don’t think the problem is related with the H-bridge.
We have a tutorial about the L298N driver with the ESP32 that may be useful to better understand how the L298N driver works: https://randomnerdtutorials.com/esp32-dc-motor-l298n-motor-driver-control-speed-direction/
Which pins are you using for PWM? Have you tried generating a PWM signal on a separated sketch and see if it is working with that pin?
Also, please note that the PWM analog range of the ESP8266 is 0 to 1023. (while with an Arduino is 0 to 255).
If you provide more details, maybe I can help you better.
Thank you for responding …
It work with the Arduino, so I put in a ESP8266 for its Wifi
How to Make Arduino ESP8266 WiFi Robot Car
but he does not use analogWrite just set enA to HIGH (255)
Learn about the L289N
Controlling DC Motors with the L298N H Bridge and Arduino
pins for NodeMCU esp8266
// Set speed range 0~255
n = 150; // this comes from webpage or C# WebClient/Speech 5.4
// Motor A
int enA = D2;
int in1 = D3;
int in2 = D4;
// Motor B
int enB = D5;
int in3 = D6;
int in4 = D7;
// server.send(200, “text/plane”, “forward … “); //Send client ajax request
analogWrite(enA, n); // n is set to 150
It moves forward, back etc … when put in
but no speed control for
just a hum from the L289N
Maybe its the Pins
Thank you Thank You Thank You
I Live and Learn … its works