delayMicroseconds
Then it can cause crashes. The reason being that it is a blocking function and eventually knackers it (explanation here https://github.com/esp8266/Arduino/issues/2240#issuecomment-230776603 )
However, there is a solution! Us a stepper library that doesn't involve blocking. One example is AccelStepper.h which has an example usage toward the end of this tutorial:
https://www.makerguides.com/drv8825-stepper-motor-driver-arduino-tutorial/
entozoon wrote:I had the same issue! It turns out that if you're controlling the stepper motor by using:
Code: Select alldelayMicroseconds
Then it can cause crashes. The reason being that it is a blocking function and eventually knackers it (explanation here https://github.com/esp8266/Arduino/issues/2240#issuecomment-230776603 )
However, there is a solution! Us a stepper library that doesn't involve blocking. One example is AccelStepper.h which has an example usage toward the end of this tutorial:
https://www.makerguides.com/drv8825-stepper-motor-driver-arduino-tutorial/
You cause analysis is correct but your solution is wrong: Accelstepper does indeed also contain blocking functions and can / will also cause wdt resets when used incorrectly, see: viewtopic.php?f=160&t=21616
I;ve searched everywhere and can't seem to figure out how to solve this problem.
Here is my stack trace:
Soft WDT reset
>>>stack>>>
ctx: cont
sp: 3ffffde0 end: 3fffffc0 offset: 01a0
3fffff80: 3fffdad0 00000392 3ffee368 4020142b
3fffff90: 3fffdad0 3ffee3b0 3ffee368 40201084
3fffffa0: feefeffe 00000000 3ffee3d8 40201e00
3fffffb0: feefeffe feefeffe 3ffe84e4 40100bf9
<<<stack<<<
Which equates to this:
Decoding stack results
0x4020142b: Stepper::step(int) at /Arduino/libraries/Stepper/src/Stepper.cpp line 198
0x40201084: loop() at /Arduino/sketch_oct14a/sketch_oct14a.ino line 21
0x40201e00: loop_wrapper() at /Arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/core_esp8266_main.cpp line 197