Loops not working

I have had this sketch working on another project where there are direction buttons.

If I rem out first loop, the motor turns as it should and if I rem out the second loop the motor turns okay the other way. However if I put the two loops in the sketch the motor does not move?

I do not get any error messages

Can someone tell me why? Thanks

//FINAL CAMERA RECEIVER
//HC12CAMERATX
#include <SoftwareSerial.h>

int i;
//declare variables for the motor pins
int motorPin1 = 9;    // Blue   - 28BYJ48 pin 1
int motorPin2 = 10;   // Pink   - 28BYJ48 pin 2
int motorPin3 = 11;   // Yellow - 28BYJ48 pin 3
int motorPin4 = 12;   // Orange - 28BYJ48 pin 4

int motorSpeed = 3500; 
int lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001};

void setup()
{
  //Serial.begin(9600);
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
}

void loop()
{


  for (int i = 0; i < 8; i++) // clockwise
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);
  }

  for (int i = 8; i >= 0; i--) // anticlockwise
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);
  }

}
  void setOutput(int out)
  {
    digitalWrite(motorPin1, bitRead(lookup[out], 0));
    digitalWrite(motorPin2, bitRead(lookup[out], 1));
    digitalWrite(motorPin3, bitRead(lookup[out], 2));
    digitalWrite(motorPin4, bitRead(lookup[out], 3));
  }

EDIT: Since checked, the loops are working, but the motor will not run one way then the other with two loops. Either single loop will make motor go forward or backwards.

Eight steps with a 3500 uSec delay = 28 mSec turning each way. That's why you don't see movement.

My guess is nothing wrong, but your loops will alternate very fast. Too fast for the motor to actually start moving.

Add a big fat delay of a few seconds after each loop and you will see the motor run

Many thanks for replies, however it was because I had left out some code to make the motor travel distance. The loops in what I pasted on the forum only contained coil sequebce swithing. The code pasted now is working and what shouls have been in the sketch. So thanks, all works fine now.

void loop()
{

  for (int i = 0; i < 500; i++)// Distance turned
  {
     clockwise();
  }

  for (int i = 0; i < 500; i++)// Distance turned
  {
     anticlockwise();
  }
}

void clockwise()
{
  for (int i = 0; i < 8; i++)
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);// Coil Sequence delay
  }
}

void anticlockwise()
{
  for (int i = 7; i >= 0; i--)
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);// Coil Sequence delay
  }
}

void setOutput(int out)
{
  digitalWrite(motorPin1, bitRead(lookup[out], 0));
  digitalWrite(motorPin2, bitRead(lookup[out], 1));
  digitalWrite(motorPin3, bitRead(lookup[out], 2));
  digitalWrite(motorPin4, bitRead(lookup[out], 3));
}