28BYJ-48 & Soft WDT Reset

I'm trying to run stepper CW then CCW but it resets before CCW command.

I've read esp8266 needs to call wifi a lot, but I don't understand how that affects this.

Error message below
⸮clockwise
Soft WDT reset

stack>>>

ctx: cont
sp: 3ffffde0 end: 3fffffc0 offset: 01b0
3fffff90: 3fffdad0 3ffee270 3ffee228 40201073
3fffffa0: feefeffe 00000000 3ffee298 40201c04
3fffffb0: feefeffe feefeffe 3ffe84f4 401004e9
<<<stack<<<

#include <Stepper.h>
// Define number of steps per rotation:
const int stepsPerRevolution = 2048;
// Wiring:
// Pin 8 16 to IN1 on the ULN2003 driver
// Pin 9 5  to IN2 on the ULN2003 driver
// Pin 10 4  to IN3 on the ULN2003 driver
// Pin 11 0   to IN4 on the ULN2003 driver
// Create stepper object called 'myStepper', note the pin order:
Stepper myStepper = Stepper(stepsPerRevolution, 16, 4, 5, 0);

void setup() {
// Set the speed to 5 rpm:
myStepper.setSpeed(10);
// Begin Serial communication at a baud rate of 9600:
Serial.begin(9600);
}

void loop() {
  // Step one revolution in one direction:
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(500);
  // Step one revolution in the other direction:
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(500);
  
}

What power supply are you using to power the UL2003 module?

I just read library stepper.h

Stepper - step()

This function turns the motor a specific number of steps, at a speed determined by the most recent call to setSpeed(). This function is blocking; that is, it will wait until the motor has finished moving to pass control to the next line in your sketch. For example, if you set the speed to, say, 1 RPM and called step(100) on a 100-step motor, this function would take a full minute to run. For better control, keep the speed high and only go a few steps with each call to step().

Syntax

step(steps)

Parameters

  • steps: the number of steps to turn the motor. Positive integer to turn one direction, negative integer to turn the other.

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