Hello everyone, sorry for using capital letters in the title but we need a quick advice, thanks for taking your time to read :slight_smile:

I need to rotate a stepper motor, using the 4 cables, connected to an Arduino Motor Shield, which is recessed in an Arduino Uno. The only thing we know about the motor is that it is a bipolar one. We don't know anything about coding, we searched for many codes on the Internet, copied/pasted them i the Arduino Software, but no one worked. That's why I'm seeking for your help to rotate this motor.

Thanking you in advance for your hep :wink:


A servo motor would be a lot easier. (since you're new to coding) If your goal is simply to have something spin 'round, then use a Continuous Rotation Servo. Or, a regular servo motor if you are going for very precise movements.

Continuous Rotation Servo motors are controlled based on speed. They can go backwards and forwards, at different speeds. THEY ONLY SPIN AT DIFFERENT SPEEDS, THEY DO NOT MOVE TO PRECISE ANGLES!

Regular servo motors are controlled based on angle. You send the motor the value of an angle, and the servo moves itself (at a high speed) to match that angle. They are not speed controlled, they simply twist themselves to match whatever angle value you wish. THEY MOVE THEIR ARM TO WHATEVER ANGLE YOU ASK FOR, THEY DO NOT SPIN!

Servos are much easier than steppers in my opinion. Especially for those who don't code.

I recommend this for Continuous Rotation:

I recommend this for a Regular Servo:

(You get a pack of twelve)

I hope you do well! Do not hesitate to ask another question on this Forum Thread, I am here to help whenever I can. :wink:

Did you see this:

Thank you all for helping,

First, the school makes us use a Motor Shield, we can't use a Servo,

Plus, I copied/pasted the codes you sent to me, but when I want to upload is says an error message of "upload problem".

So, unfortunately, it does'nt work yet :cry:


If its so urgent because of close exams, what has your school/university been teaching you up to now?

What subject is this for and when are your exams?

Tom... :o

Hi Tom, I'm french and I am in high school, I'll try to explain our project, but sorry english isn't my native language.

We are building a system that close a plastic bag in a bin, when the motor turn, a closure bar moves and close the bag.

So, we need to rotate the motor in a way, wait a certain amount of seconds so the user can take the bag, then rotate the motor in the other way.

I hope you understood, thank you for answering :slight_smile:

The forum has a francophone section

Plus, I copied/pasted the codes you sent to me, but when I want to upload is says an error message of "upload problem".

So, unfortunately, it does'nt work yet :cry:

And how many hours of concerted effort have you given to trying to figure out and fix the problem?

I hope you intend to include a link to this Forum Thread as part of your exam content.


Thanks to a code example which is included in the Arduino software, the motor is now rotating, I have the following code:

#include <Stepper.h>

const int stepsPerRevolution = 300; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
// set the speed at 60 rpm:
// initialize the serial port:
Serial.begin(4000) ;

void loop() {
// step one revolution in one direction:

// step one revolution in the other direction:

I changed the Delay to 10000, and the stepsPerRevolution to 300. I wanted to know what Serial.begin(4000) means. By the way, I would like the motor rotate in one way, the in the other, just one time, by pushing a LK-Button2.

Thank you all for your help

I wanted to know what Serial.begin(4000) means.

It means set the serial line bit rate to the very non-standard rate of 4000 bits per second.

Ok, thank you, it was normally set to 9600

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.