-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
Hey there!
I am currently using a WEMOS D1 mini together with a 4-Pin stepper motor.
It works correctly but after turning it, the esp runs through a software reset.
The Exception Decoder says the following:
0x402016a4: Stepper::stepMotor(int) at D:\Arduino\libraries\Stepper\src\Stepper.cpp line 356
0x402016df: Stepper::step(int) at D:\Arduino\libraries\Stepper\src\Stepper.cpp line 198
My code looks like this:
#include <NTPClient.h>
#include <Stepper.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
// wifi settings
const char *ssid = "Martin Router King";
const char *password = "<secret password here>";
// ntp settings
const long utcOffsetInSeconds = 3600;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
// stepper settings
Stepper Motor(2048, D1, D3, D2, D4);
void setup(){
Serial.begin(115200);
// wifi
WiFi.begin(ssid, password);
while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( "." );
}
Serial.println("Connected!");
// ntp
timeClient.begin();
// stepper
Motor.setSpeed(10);
}
void loop() {
timeClient.update();
int currentHour = timeClient.getHours();
if(currentHour % 12 == 0 && timeClient.getMinutes() == 6 && timeClient.getSeconds() == 0){
Serial.println("Liftoff!");
Motor.step(2048);
}
delay(1000);
}
The stepper motor is connected as follows:
IN1 -> D4
IN2 -> D3
IN3 -> D2
IN4 -> D1
As I said, it works and rotates but after its done my esp resets :/
Also I couldn't find any issue in the Stepper.cpp/Stepper.h (for my low experience level with C++).
EDIT: I tried using only the stepper motor without any NTP or anything else, it keeps resetting.
Metadata
Metadata
Assignees
Labels
No labels