adafruit / Adafruit_Motor_Shield_V2_Library

Arduino library for Adafruit Motor Shield v2!
https://www.adafruit.com/products/1438
Other
193 stars 128 forks source link

WDT Error and following automatic Reset #23

Closed rudydevolder closed 7 years ago

rudydevolder commented 8 years ago

I found the solution already see: [https://github.com/esp8266/Arduino/issues/2377 ] By adding in the library-code the delay(0) command.: *

  while (steps--) {
    //Serial.println("step!"); Serial.println(uspers);
    ret = onestep(dir, style);
    delayMicroseconds(uspers);
    //Rudy De Volder: to solve WDT problem with the ESP8266 simply add the following line:
    delay(0);
  }

*

karelv commented 7 years ago

A similar issue on my Feather Huzzah / motor shield is present. I hope your patch fits also my HW!

According to: https://github.com/esp8266/Arduino/blob/master/doc/reference.md#timing-and-delays you might also consider to replace the

delay (0);

by

yield();

I will try later today... and let you know.

ladyada commented 7 years ago

ok added a yield, please tr it!

https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library/commit/a315ff70884e3c43a144b522d67d61267bd4cf6d

karelv commented 7 years ago

I checked both delay (0); and yield (); ==> both are working for me. Thanks for adding the yield function.