stepper motor code on arduino uno stack with motor shield v2.0

Hi there, I'm new in arduino and stepper motor . Basically i setup a bipolar stepper motor on to an arduino uno stack with motor shield kit v2.0 with the help on the tutorial . Does anyone know how to write a code so that my stepper motor can rotate from 45 to 90 degree and then stop for 5 seconds and go back to the origin position? I know its a very basic stuff, but i don't have no any electrical based or what so ever.

It would a big help to me, massive gratitude.

with the help on the tutorial

The last time I looked, there were at least two bazillions tutorials on the internet. Which ONE did you follow?

Does anyone know how to write a code so that my stepper motor can rotate from 45 to 90 degree

Well, first you rotate to 45 degrees. That's some undefined number of steps. Then, you step some more until you have rotated 1/4 turn. Then, you wait a while. The blink without delay function shows one way. The other example shows another way.

Then, you step in the other direction some undefined number of steps.

Now the number of steps won't be undefined for you, because you know something about your motor that you didn't share.

this is the code that i wrote .
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup() {
Serial.begin(9600);

AFMS.begin();

myMotor->setSpeed(10); // 10 rpm
}

void loop() {
Serial.println("Single coil steps");
myMotor->step(50, FORWARD, SINGLE);
myMotor->step(50, BACKWARD, SINGLE);
}

but the problem now is once i done upload it, my stepper motor doesn't move . basically it just vibrates there.
I used the usb to power supply my motor and also 4 AA batteries not at the same time.
If i power supply my motor using usb , the green light on my motor shield keeps blinking , and theres orange light lighted on my Arduino uno , i sensed there might have some problems.
So i change it to using 4 AA batteries to supply, but there another problem occurred. which is the motor is not moving at all even though there's no more orange light and the green light on the motor shield is lighted not blinking.

you should try without setting the motor speed first

So i change it to using 4 AA batteries to supply, but there another problem occurred. which is the motor is not moving at all even though there's no more orange light and the green light on the motor shield is lighted not blinking.

What stepper motor do you have? I think that you are seriously underestimating the amount of current (and voltage) that a stepper motor needs. And, I mean seriously. A car battery is more like what you should be using.

I'm using a normal bipolar stepper motor : http://www.oriental-motor.co.uk/Products/Stepper_motors/Stepper_motors/high_torque_2phase_motors_pkp/?&filter1=Standard&filter2=28+mm&arid=7977&dwn=artnr

now that i setup without speed , the motor start moving. but it started move one step to left and then one step to right continuously . I went to check on my wiring connection, its might be the problem. But the problem still occurred .

The motor seems to be working as commanded...

myMotor->step(50, FORWARD, SINGLE); 
myMotor->step(50, BACKWARD, SINGLE);

Each time thru the loop you take a step forward and then a step backward.

i don't think you get what i meant. aren't it suppose to move 50 steps from 0 degree to 45 degree since its written " Serial.println("Single coil steps");
myMotor->step(50, FORWARD, SINGLE); " and its 1.8 degree per step.

but it seems to move left and right continuously ( estimated less than 5 degree )

IMG_4508.MOV (2.69 MB)

i have attached a video on the precious post. i think its easier if u watch the video.