stepper motor angular movement control

I am working on project where, I have the arduino uno contrller and stepper motor. I want to program the controller such a way that, if i press F it should go +90 and if i press R it should go -90. i have attached the program but it is not working continously. it gets stop after two or three attempets.

#include <Stepper.h>

const int stepPerRevoluation = 200; // number of steps in motor.
const int halfRevoluation=50; // 90 degree rotation

Stepper stepper (stepPerRevoluation, 12,11,9,10);
char turn = ’ ';

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
Serial.println("press ‘F’ to turn forward and ‘R’ to turn Reverse ");
stepper.setSpeed(15);

}

void loop(){
if (Serial.available() > 0) {
//read the incoming char:
turn = Serial.read();

if (turn== ‘F’)
{
// say what you got:
Serial.print("turns forward ");
stepper.step(halfRevoluation);
delay(100);

}
if (turn== ‘R’)
{
// say what you got:
Serial.print("turns reverse ");
stepper.step(-halfRevoluation);
delay(100);

}

}

How do You power Your project? Attach the wiring. Also, check how to post code using code tags </>…

How do You power Your project? Attach the wiring. Also, check how to post code using code tags </>…

i have motor of 2.5 A. I am giving power to motor using 5 v of power adapter and usb connection with my pc is that enough??

there is no any external power given to motor. the motor is connected to port of uno and the board is powered by 5v, 2.4 A adapter.

Attach a wiring diagram, please.

Post links to the datasheet for your stepper motor and tell us what stepper motor driver you are using.

If there are 200 steps for a full revolution how could 50 steps be a half revolution?

...R Stepper Motor Basics Simple Stepper Code

I asume half revolution means 90 degree rotation. +90 and -90 rotation is needed.

17H2A_nuvarande.pdf (58.1 KB)

model number :17H2A9425

its a Adafruit TB6612 1.2A DC/Stepper Motor Driver

Please post a link to the datasheet for the motor. I am not going to do your searching for you.

I asume half revolution means 90 degree rotation

You are the guy writing the program - why can't you be sure?

...R