Like, Share and Subscribe for more projects and tutorials
Code:
const int stepPin = 9;const int dirPin = 8;
const int enPin = 13;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
digitalWrite(enPin,LOW);
}
void loop() {
digitalWrite(dirPin,HIGH); // anticlockwise direction
for(int x = 0; x < 800; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // One second delay
digitalWrite(dirPin,LOW); // clockwise driection
for(int x = 0; x < 800; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
}
I am so interested in your project and i have watched video for many times.Also i will start my robot project, i just buy 2 nema
ReplyDeletenema 17 stepper motor from oyostepper.com.
nema 23 stepper motor is a stepper motor with a 2.3 x 2.3 inch faceplate. It is suitable for 3d printer, robot arm, cnc machine,etc. In low-speed applications, the stepper motor can be driven at the desired speed without missing a single step.
ReplyDeletesee more at oyostepper.com.
Hi pavandeep,
ReplyDeletei got the same exact things as you suggested in video and connected as per your recommendation. Code is also working fantasic when the arduino is connected to laptop. But when i disconnect the laptop, the motor does not run! what could be the problem, i have double verified and all connections are done very properly, so what could be the issue? Thanks for your reply in advance,
harikrishna.
Hi iam doing a project I need help I want to controlle speed of a motor with potentiometer. P1 for one direction and P2 for another direction please help me to write code.
ReplyDeleteMail me to raj2018n@gmail.com