- Sun Apr 15, 2018 5:01 pm
#75405
I am looking for a help in the very same project!!
I am a teacher at 24 student class. Each one with a NodeMCU and Nodmcu Motor Shield trying to make a 2WD car run.
I think I have connected the pins properly and all the Digital OUTPUTS work well as long as I use them to ligh LEDS.
Anyway, at the point that we try to make the motors RUN it does NOT work at all.
I am using the D1 and D2 as PWM inputs and the D3 and D4 as rotation inputs but nothing works.
Simple code, make it run forward for 2 seconds backward for another 2 secondas.
The bridge for VI and VH is done.
I have opened a new issue in General discussions although this would have been a better place for this.
Any help would be nice!
#define D0 16
#define D1 5 // I2C Bus SCL (clock)
#define D2 4 // I2C Bus SDA (data)
#define D3 0
#define D4 2 // Same as "LED_BUILTIN", but inverted logic
#define D5 14 // SPI Bus SCK (clock)
#define D6 12 // SPI Bus MISO
#define D7 13 // SPI Bus MOSI
#define D8 15 // SPI Bus SS (CS)
#define D9 3 // RX0 (Serial console)
#define D10 1 // TX0 (Serial console)
void setup() {
pinMode(D1, OUTPUT); // PWM A
pinMode(D2, OUTPUT); // PWM B
pinMode(D3, OUTPUT); // Rotation A
pinMode(D4, OUTPUT); // Rotation B
}
// the loop function runs over and over again forever
void loop() {
analogWrite(D1, 1023);
analogWrite(D2, 1023);
digitalWrite(D3, HIGH);
digitalWrite(D4, HIGH);
delay(2000);
analogWrite(D1, 0);
analogWrite(D2, 0);
digitalWrite(D3, LOW);
digitalWrite(D4, LOW);
delay(2000);
}
You do not have the required permissions to view the files attached to this post.