AccelStepper on ESP8266 Serial gibberish

Whenever I use AccelStepper on an ESP8266 (NodeMCU) I can't print to serial monitor.

#include <AccelStepper.h>

// Define a stepper and the pins it will use
#define motorPin1  8      // IN1 on the ULN2003 driver
#define motorPin2  9      // IN2 on the ULN2003 driver
#define motorPin3  10     // IN3 on the ULN2003 driver
#define motorPin4  11     // IN4 on the ULN2003 driver

#define MotorInterfaceType 8

AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4);

void setup() {

  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("starting sketch");
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("looping");
  delay(30000);
}

results in this sort of stuff

⸮P⸮⸮⸮4⸮a⸮⸮⸮⸮⸮4<⸮
23:18:38.893 -> ⸮⸮4>⸮⸮X⸮⸮a;E⸮T	
23:18:55.834 -> ⸮⸮⸮4⸮a#⸮⸮⸮
23:19:04.306 -> ⸮⸮4⸮a⸮⸮⸮⸮
23:19:12.777 -> ⸮⸮4⸮a⸮⸮⸮⸮
23:19:21.243 -> ⸮⸮Ԝ⸮⸮bQ⸮⸮⸮4⸮ΫbQ⸮⸮⸮4⸮a⸮Z+⸮P⸮⸮p⸮⸮⸮⸮
23:19:55.091 -> ⸮⸮⸮5⸮⸮h⸮⸮⸮⸮⸮4⸮L⸮⸮e⸮X⸮zHk;⸮⸮⸮eX⸮z⸮⸮⸮H⸮⸮⸮
X⸮z⸮⸮N⸮⸮⸮⸮⸮X⸮z⸮⸮	⸮⸮R⸮K⸮⸮⸮⸮⸮⸮⸮(⸮⸮

commenting out
AccelStepper stepper = AccelStepper(MotorInterfaceType, motorPin1, motorPin3, motorPin2, motorPin4);

fixes the issue

What happens if you change the pins?

Why are you using GPIO8,9,10 and11. GPIO8 and GPIO11 aren't even brought out to pins on the NodeMCU.

@missdrew and @SteveMann thank you for pointing that out.... n00b error :joy:

All fixed by changing the pins

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.