I want to connect a Stepper motor to my arduino. I have downloaded a libary (CheapStepper.h)
When I try the example in the libary it works perfectly on my Uno, but when I connect my Wemos D1 I just get this strange message on the serial:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
I have tried with 2 different Wemos, and also stepper codes that do not require the libary (http://www.instructables.com/id/BYJ48-Stepper-Motor/) and I can not get it to work.
Any one have any idea how I can resolve this?
#include <CheapStepper.h>
CheapStepper stepper;
// here we declare our stepper using default pins:
// arduino pin <--> pins on ULN2003 board:
// 8 <--> IN1
// 9 <--> IN2
// 10 <--> IN3
// 11 <--> IN4
// let's create a boolean variable to save the direction of our rotation
boolean moveClockwise = true;
void setup() {
// let's just set up a serial connection and test print to the console
Serial.begin(9600);
Serial.println("Ready to start moving!");
}
void loop() {
// let's move a full rotation (4096 mini-steps)
// we'll go step-by-step using the step() function
for (int s=0; s<4096; s++){
// this will loop 4096 times
// 4096 steps = full rotation using default values
/* Note:
- you could alternatively use 4076 steps...
- if you think your 28BYJ-48 stepper's internal gear ratio is 63.68395:1 (measured) rather than 64:1 (advertised)
- for more info, see: Geared Stepper Motor - Motors, Mechanics, Power and CNC - Arduino Forum)
*/
// let's move one "step" (of the 4096 per full rotation)
stepper.step(moveClockwise);
/* the direction is based on moveClockwise boolean:
- true for clockwise, false for counter-clockwise
- -- you could also say stepper.stepCW(); or stepper.stepCCW();
*/
// now let's get the current step position of motor
int nStep = stepper.getStep();
// and if it's divisible by 64...
if (nStep%64==0){
// let's print the position to the console
Serial.print("current step position: "); Serial.print(nStep);
Serial.println();
}
}
// now we've moved 4096 steps
// let's wait one second
delay(1000);
// and switch directions before starting loop() again
moveClockwise = !moveClockwise;
}