nema17- motor ansteuern - WDT Problem beim Step befehl

Hallo ihr wissenden,

ich habe ein Problem mit meinem Code. sobald ich mehr Umdrehungen mache, habe ich Probleme mit dem WDT und mein ESP startet neu.
Kurz zur Hardware: Nema17 Motor, L298n Brücke und ein ESP8266.
Über mqtt bekommt er einen Wert und soll dann entsprechend reagieren.

Wenn ich nun
myStepper.step(-stepsPerRevolution); wähle, ist alles gut. Sobald ich
myStepper.step(-stepsPerRevolution*umdrehungen); mache, kommt das Problem.

Woran mag das liegen? bzw. wie behebe ich das?

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <Stepper.h>
int status = 0;
// ###########  WIFI  ############################################
// Update these with values suitable for your network.
const char* ssid = "xxx";//put your wifi ssid here
const char* password = "xxxxxx";//put your wifi password here
const char* mqtt_server = "x";
const char* clientId = "chickenDoor";
const char* userName = "xxx";
const char* passWord = "xxx";
// #################  Motor  #######################################
// Number of steps per output rotation
const int stepsPerRevolution = 200;
// Create Instance of Stepper library
Stepper myStepper(stepsPerRevolution, 14, 12, 4, 5);
int umdrehungen = 5;
// #################  Sound  #####################################
int frequency=400; //Specified in Hz
int buzzPin=2; 
int timeOn=1000; //specified in milliseconds
int wartezeit = 10000;
// ################################################################
WiFiClient espClient;
PubSubClient client(espClient);

void setup_wifi() {
  delay(100);
  // We start by connecting to a WiFi network
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  randomSeed(micros());
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}
// ################################################################
void callback(char* topic, byte* payload, unsigned int length)
{
  Serial.print("Command from MQTT broker is: [ \n");
  Serial.print(topic);
  Serial.print("\n");
  int p = (char)payload[0] - '0';
  // #################  Bewegungs Auswahl  ###########################
  if (p == 1)  // Hochfahren
  {
   myStepper.step(-stepsPerRevolution); 
    status = 1;
    Serial.print("  Aus \n" );
    p = 0;
  }
  // ################################################################
  else if (p == 2)  // Runterfahren
  {
    Serial.print("  Runterfahren  \n");
    tone(buzzPin, frequency);
    delay(timeOn);
    noTone(buzzPin);
    delay(wartezeit);
   myStepper.step(-stepsPerRevolution*umdrehungen); 
    status = 2;
    Serial.print("  Aus  \n" );
    p = 0;
  }
  else
  {
    Serial.print("  Aus \n" );
    p = 0;
  }
}
// ###################  RECONNECT  ################################
void reconnect() {
  // Loop until we're reconnected
  while (!client.connected())
  {
    Serial.print("Attempting MQTT connection...\n");

    // Attempt to connect
    if (client.connect(clientId, userName, passWord))
    {
      Serial.println("connected");
      //once connected to MQTT broker, subscribe command if any
      client.subscribe("chickenDoor");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 6 seconds before retrying
      delay(6000);
    }
  }
}
// ################################################################
void setup() {
  Serial.begin(115200);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
// ##################  Speed   ####################################
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
}
//#################################################################
void loop() {
  if (!client.connected()) {
    reconnect();
  }

  client.loop();


}

Eine Stepper Library verwenden, welche nicht blockiert.
Oder wenigstens zwischen durch mal yield() oder delay() aufruft.

--
Dein Wissender

Kannst du mir da eine andere Library empfehlen?