Hi,
I am relatively new to adruino and this whole space. I am currently trying to power a DC motor using an ESP12E motor shield and an ESP8266 Module
Motor Shield - https://www.amazon.com/gp/product/B078CPZDW1/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
ESP8266 - https://www.amazon.com/gp/product/B010O1G1ES/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
DC Motor - https://www.amazon.com/gp/product/B07MTT7B88/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
Here is my code
#define DIRA 0
#define PWMA 5
#define LED 2
void setup() {
Serial.begin(9600);
Serial.println();
Serial.println("Starting...");
Serial.println("Preparing motor...");
pinMode(DIRA, OUTPUT);
pinMode(PWMA, OUTPUT);
analogWrite(PWMA,0);
digitalWrite(DIRA,1);
delay(5000);
Serial.println("Starting motor...");
analogWrite(PWMA,5);
delay(5000);
}
void loop() {
}
I am expecting the motor to start once I upload this code but nothing is happening. If I change the analogWrite to digitalWrite, the motor runs but I want to be able to control the speed, rather than just having it run at one speed.
I have tested using analogWrite by changing the intensity of an LED and it was working, although the output pin was not the same as the one I use for the motor.
Would greatly appreciate any help as I have already gone through pages of google searches without any luck. I have been using this example as a reference, Node MCU Motor Shield | Details | Hackaday.io.
Thank you in advance