Arduino how to stepper motor direct control with motor shield?

Hello, I new started arduino help me please :slight_smile:

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.

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.


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

// 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);