Hey everyone
Hopefully i put this question of mine in the right section.
I started a project for my final project for school and it included using an arduino which i am very basic with, such as blink a light on and off or making a stepper motor turn in one direction and playing around with the variables.
My question to you guys is that I've been having a lot of trouble coding my stepper motor to turn an X amount of steps and then delay for an X amount of time before repeating this process over and over.
My project is basically a battery swapping exchange station for drones and there is a large drum on one side with will allow me to turn the battery into position and then stop to allow the battery time to get out of the drum and into the drone. If anyone can help me with this code that ive been trying to look for it would help me greatly.
Ive been using a basic arduino with a motor controller shield here: 2 Channel H-Bridge Motor Driver Shield for Arduino | Freetronics
As well as a 200 step, stepper motor:
Everything runs off a 12V power supply
This is the code that im currently using
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 4, 7, 3, 2);
int stepCount = 0; // number of steps the motor has taken
void setup() {
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one step:
myStepper.step(1);
Serial.print("steps:" );
Serial.println(stepCount);
stepCount++;
delay(100);
}
Please help ![]()