so my background,
just getting back into this stuff. i haven't been the greatest at it understanding it wise; but i am trying and really want to get good.
so i have found go to get my stepper motor to turn on and rotate.
now i'm trying to put a button in play that when it is pressed it starts the rotation of the stepper and the stepper rotate a certain number of times.
is there a code that exist that does this already for one stepper?
if not where is a good place for me to start to look to understand.
is there an Arduino project that i can do to help myself learn what this type of come is saying and how its applied?
//Simple stepper motor control demo
const int stepPin = 3; //pin to pulse for steps
const int dirPin = 2; //pin to change step direction
void setup(){
//set pins as outputs
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop(){
//step forward 100 steps
stepperFWD();
for(int i = 0; i < 100; i++){
motorStep();
delay(1);
}
//step backwards 100 steps
stepperREV();
for(int i = 0; i < 100; i++){
motorStep();
delay(1);
}
}
//change the stepper direction to forward
void stepperFWD(){
digitalWrite(dirPin, HIGH);
}
//change the stepper direction to reverse
void stepperREV(){
digitalWrite(dirPin, LOW);
}
//have the stepper motor take one step
void motorStep(){
digitalWrite(stepPin, HIGH);
delay(1);
digitalWrite(stepPin, LOW);
}
this is just a code that i have that i took from someone else as a starting point. i will be taking reverse out so that isnt an issue. so this is where im at for trying to understand what is being said. oh yeah how do i attach code so it isnt so big on the screen