Newbie ?: Rrun stepper program just once?

Total newbie here but making progress quickly… super stoked!

My problem is I am running a stepper motor to pull a trolley a certain distance so I need the “program” to only run once… From my searching, everyone says just put those commands into the “void setup” but when i move the “stepper.step(200)” command into the setup, the motor does nothing… in the void loop, it runs great, at a continuous rate and i am able to change the speed by changing the rpms in the code.

The code that runs properly (for ever) is:

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it’s
// attached to
Stepper stepper(STEPS, 00, 01, 02, 03);

void setup()

pinMode(00, OUTPUT);
pinMode(01, OUTPUT);
pinMode(02, OUTPUT);
pinMode(03, OUTPUT);


void loop()

I’ve tried moving the stepper.step(50) command into the setup but again, the motor doesn’t budge.

thanks in advance!

In the loop section you would just give it something that never ends like: while(1);

If you are using an Arduino board with USB then the problem may be a conflict on pins 0 and 1. Try using pins 2-5.

BTW, the stepper library does the pinMode for you, the calls in your sketch are not necessary.

I would be interested to hear if changing pins solves your problem.