Подскажите что доделать, чтобы в момент работы шагового двигателя (30 секунд и более) Blynk не подвисал и не вылетал с ошибкой - Soft WDT reset
Вот часть моего кода:
Good evening.
Tell me what to finish, so that when the stepper motor is running (30 seconds or more), Blynk does not move or fly with an error - Soft WDT reset
Here is part of my code:
BLYNK_WRITE(V0) // Кнопка
{
if (param.asInt() == 1 && oldposition == 0) // Проверяе закрывать если было открыто
{
oldposition = param.asInt();
EEPROM.write(0, oldposition); // Записываем в память последнее положение
EEPROM.commit();
gostep(1000);
}
if (param.asInt() == 0 && oldposition == 1) // Проверяем открывать если было закрыто
{
oldposition = param.asInt();
EEPROM.write(0, oldposition); // Записываем в память последнее положение
EEPROM.commit();
gostep(-1000);
}
}
void gostep (int stepper)
{
myStepper.step(stepper);
}
WDT reset je vezan gotovo isključivo za greške u kodu, a da bi do tih grešaka mogli da dođemo, opet moraš da nam daš dovoljno podataka: info o platformi koja se koristi, za početak, i propisno formatiran kod mogli bi dosta da pomognu i tebi, i nama. Uz obaveznu upotrebu engleskog, naravno, kako bi svi mogli da shvatimo o čemu se radi.
Platform - Wemos D1 mini
On this Board, stepper motor works fine. But as soon as I connect to Blynk, Blynk hangs. Hangs at the very moment of engine operation
Is there something else in void loop except Blynk.run and/or timers? What do you see in Serial monitor when Wemos hangs? Pls paste whole code, it would be much easier.
In file included from /Users/dima/Documents/Arduino/Blinds_28BYJ_Blynk/Blinds_28BYJ_Blynk.ino:5:0:
/Applications/Arduino.app/Contents/Java/libraries/Stepper/src/Stepper.h:122:6: error: expected constructor, destructor, or type conversion before '(' token
delay(0);
^
exit status 1
Ошибка компиляции для платы WeMos D1 R2 & mini.
On another note…
You will burn through your eeprom the way you use it
It has limited writes. I suggest you try to sync a virtual pin with your “oldposition” instead, and if you are not connected to Blynk then and only then use eeprom instead .
Reads from eeprom don’t burn the memory.
if (Blynk.connected())
Blynk.virtualWrite(save_vPin, oldposition);
else
{
EEPROM.write(0, oldposition);
EEPROM.commit();
}
You need to work out quirks like which space was saved last as to know which to use of course.
But see this as a hint in a direction
A number that pops up is 100,000 write-cycles, whilst that may seem so far away from your code right now,
if you continue that path you might just want to… save a little more… save a little more often … and then… one hot summer day KABOOM! And your device is toast, or atleast its memory
So while you are not in any super danger right now I thought I’d just enlighten you !
Also for strictly saving values to virtual pins I suggest using those at the far end, if not defined for more then, those at V34-35.
The moment you add widgets that use a virtual pin the save value is nulled, so for storing data best use pins that will not have widgets assigned to them!