if (val == "up")
{
stepperY.setSpeed(500);
stepperY.moveTo(stepperY.currentPosition()-1000);
stepperY.run();
//val="";
}
if (val == "down")
{
stepperY.setSpeed(500);
stepperY.moveTo(stepperY.currentPosition()+1000);
stepperY.run();
//val="";
}
im trying to make the stepper move CW or CCW by adding + or - but stepper moves CW earther way?
I tryed set current position to 0...
Robin2
September 10, 2017, 10:51am
2
Post the complete program.
...R
Here it is
sketch_sep10a.ino (16.2 KB)
Robin2
September 10, 2017, 11:27am
4
If you are unsure how to control your motor start learning with a short program that has 10 or 20 lines of code. That way it is much easier to help you.
The program you posted in Reply #2 seems to be very similar to the program in your other Thread which I said was a pretty crap program
...R
Stepper Motor Basics
Simple Stepper Code
Rebelstudios:
if (val == "up")
{
stepperY.setSpeed(500);
stepperY.moveTo(stepperY.currentPosition()-1000);
stepperY.run();
//val="";
}
if (val == "down")
{
stepperY.setSpeed(500);
stepperY.moveTo(stepperY.currentPosition()+1000);
stepperY.run();
//val="";
}
im trying to make the stepper move CW or CCW by adding + or - but stepper moves CW earther way?
I tryed set current position to 0...
What stepper motor are you using? The 28BYJ-48 needs to have 2 wires reversed in order to turn both directions. At least mine did.
its a Nema 17 : 4 wires : used with a easydriver : DRV8825
Is it possible just to set the dir pin high or low when (val == "up")
Robin2
September 10, 2017, 3:12pm
7
Rebelstudios:
its a Nema 17 : 4 wires : used with a easydriver : DRV8825
A Sparkfun Easydriver does not use a DRV8825.
Is it possible just to set the dir pin high or low when (val == "up")
Yes.
...R
Cool...
Hey thanks for all your info sofar
@
i read your posts about making a sketch from zero and the bleutooth post. and i was planning to make a sketch myself but its to much that i need to learn all at ones. i have codes (i understand) but to make them bleutooth is learning about strings and ints and vals, states.
This sketch is almost perfect and i know its not imposible to add just this one more function to it.
here's a video where i explain the problem, and where you can see what works fine
if (val == "up")
{
stepperY.setSpeed(500);
digitalWrite(dirY, LOW);
stepperY.run();
//val="";
}
if (val == "down")
{
stepperY.setSpeed(500);
digitalWrite(dirY, HIGH);
stepperY.run();
//val="";
}
result in the same movement
Problem solved
if (val == "up")
{
stepperY.setSpeed(2500);
stepperY.moveTo(stepperY.currentPosition()+1000);
stepperY.runSpeedToPosition();
}
if (val == "down")
{
stepperY.setSpeed(2500);
stepperY.moveTo(stepperY.currentPosition()-1000);
stepperY.runSpeedToPosition();
}
if (val == "left")
{
stepperX.setSpeed(2500);
stepperX.moveTo(stepperX.currentPosition()+1000);
stepperX.runSpeedToPosition();
}
if (val == "right")
{
stepperX.setSpeed(2500);
stepperX.moveTo(stepperX.currentPosition()-1000);
stepperX.runSpeedToPosition();
}