Help with step motor and L293D

Hello, I followed the tutorial link Got the step motor working. But I am still not clear how work.

In the serial monitor I enter 512, it makes quarter of a turn, when I enter 1024. it makes a half turn.. so on and so forth.

I did an experiment, modified the loop section to this:

void loop()
{
  //if (Serial.available())
  //{
    //int steps = Serial.parseInt();
    int steps = 45; // As long as the step > 0, it will just continue rotates????
    Serial.println(steps);
    motor.step(steps);
  //}
}

In the step line, I entered 45, expecting it to turn 45 degrees, but I just keeps turning as a matter of fact, no matter what number I enter, (besides 0), it will just continue rotates. Could someone please help me understand why that is ? Thank you.

The loop() function loops, so it will continue to execute 45 steps forever.

If you want something to happen just once, when you start the Arduino, put it in setup().

jremington:
The loop() function loops, so it will continue to execute 45 steps forever.

If you want something to happen just once, when you start the Arduino, put it in setup().

Ah, of course. didn't think of that. Thanks!

af1812:
In the step line, I entered 45, expecting it to turn 45 degrees,

45 is the number of steps. How many degrees depends on how many steps there are in a full rotation.

...R
Stepper Motor Basics
Simple Stepper Code