Double Check?

Hi,
I wrote a small program to draw a square spiral in 1mm increments on my XY Plotter. The problem I am having is that the plotter only moves to the right, and is not expanding the way I have programmed it to. I have looked over this code for a couple of hours, and can’t seem to find what is wrong, I think having a fresh pair of eyes look over it might help catch what might be wrong. Thanks for your help!

#include "MeOrion.h"

int dirPin = mePort[PORT_1].s1;//the direction pin connect to Base Board PORT1 SLOT1
int stpPin = mePort[PORT_1].s2;//the Step pin connect to Base Board PORT1 SLOT2
int dirPin2= mePort[PORT_2].s1;
int stpPin2= mePort[PORT_2].s2;
int i=0;
int rightMov;
int leftMov;
int downMov;
int upMov;
int x=0;
int y=0;
int repitions=0;




void setup()
{
  pinMode(dirPin, OUTPUT);
  pinMode(stpPin, OUTPUT);
  Serial.begin(9600);
}

void step(boolean dir,int steps)//Controls Step Motor 1
{
  digitalWrite(dirPin,dir);
  delay(50);
  for(int f=0;f<steps;f++)
  {
    digitalWrite(stpPin, HIGH);
    delayMicroseconds(800);
    digitalWrite(stpPin, LOW);
    delayMicroseconds(800); 
  }
}
void step2(boolean dir2 , int steps2) //Controls Step Motor 2
{
digitalWrite(dirPin2,dir2);
delay(50);
for(int j=0;j<steps2;j++)
{
digitalWrite(stpPin2,HIGH);
delayMicroseconds(800);
digitalWrite(stpPin2,LOW);
delayMicroseconds(800);  
}  
}

void SerialPrint()
{
Serial.println();
Serial.print(x);
Serial.print(" ,");
Serial.print(y);  
}

void Spiral()
{
 //------------------------------------------- 
//Algorithm (scaled: 1MM= 5 distance)
if(i==0)
{
rightMov=5;  
}
rightMov= 5+ ((2*i)-1)*5;
downMov= 5+ (2*i);
leftMov= 5+ (2*i);
upMov= 5+ ((2*i)+1)*5;

//--------------------------------------------------
//Expanding the spiral while monitoring the Voltage
repitions= rightMov/5;
Right(repitions);
repitions= downMov/5;
Down(repitions);
repitions= leftMov/5;
Left(repitions);
repitions= upMov/5;
Up(repitions);
i += 1;
}

//------------------------------
void Right(int repitions)
{
  for( int mov=1; mov>=repitions; mov++)
  {
  step(0,5);
  delay(1000); 
  x += 1;
  //Add a Voltage here
  }
}
void Down(int repitions)
{
 for(int u=1; u>=repitions; u++ )
 {
 step2(1,repitions);
 delay(1000); 
 y += -1; 
 //Add voltage here
 } 
}
void Left(int repitions)
{
for(int t=1; t>=repitions;t++)
  {
  step(1,repitions);
  delay(1000);
  x += -1;
  //Add Voltage Here
  }  
}
void Up(int repitions)
{
for(int r=1;r>=repitions;r++)
{
  step2(0,repitions);
delay(1000);
y+= 1;
//Add Voltage Here
}  
}
void loop()
{
  Spiral();
  
}

Add some Serial.print()s at strategic points so that you can see which code portions are being executed and what the value of pertinent variables is at at those points.

...and STOP CROSS-POSTING.

Thread locked.