Go Down

Topic: Arduino how to stepper motor direct control with motor shield? (Read 152 times) previous topic - next topic

ramazanalkann

Hello, I new started arduino help me please :)

My problem ı want to control my stepper but not using g-code sender or another things.

Control shield and 28BYJ-48 Stepper motor photo:



I want to control this stepper motor in arduino code, like ı start arduino then motor is turning and stopping looping everytime.I dont want to use another applications for g code send directly control on arduino how ı am do this help me please.

Robin2

There must be dozens of Forum Threads about controlling 28BYJ stepper motors. They are not normally used for CNC so that GCode is not normally used with them.

It will be much easier to help if you tell us what you want to use the stepper motor for.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

ramazanalkann

Thank you for reply, I find this code working for me :)

Code: [Select]
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(48, 2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  motor.setSpeed(1000);  // 10 rpm   
}

void loop() {
  motor.step(100, FORWARD, MICROSTEP);
}

Go Up