Control servos with SSC-32U [URGENT]

Hi I’m trying to move a servo from a position to another position. I’m using SSC-32U and Processing. the function seems very easy but when I run it, it stays at the minimum position and never goes to the maximum position.
here is my code. eyeMove (); is the function I’m having trouble with. the move(); function is writing serial on the board. I run the eyeMove(); in void draw()

void eyeMove(int posMax, int posMin) {  

   for (int i=0; i<pins.length; i++) {
move(pins[i], posMin, 1000);
delay(500);
move(pins[i], posMin, 1000);

posMin += 500; 
println("min");

if (posMin >= posMax) {
    println("max");
  posMin = 500;
  //delay(100);
}
//delay(1000);  

}
//delay(1000);
}

void move (int servo, int posi, int time) {
String srv = Integer.toString(servo);
String pos = Integer.toString(posi);
String t = Integer.toString(time);

myPort.write("#");
myPort.write(srv);
myPort.write(" P “);
myPort.write(pos);
myPort.write(” T");
myPort.write(t);
myPort.write(" \r");
}

sorry the function is wrong, this is the code I’ve been working on
void eyeMove(int posMax, int posMin) {

for (int i=0; i<pins.length; i++) {
move(pins[i], posMin, 1000);
delay(500);

posMin += 500; 
println("min");

if (posMin >= posMax) {
  println("max");
  posMin = 500;
  //delay(100);
}
//delay(1000);

}
//delay(1000);
}

Please format your code :blush:

It consist on these two steps:

  1. In your code editor (PDE, VS code, Eclipse, etc) ensure you execute the beautifier function. This function automatically indents your code. Auto-indenting makes your code easier to read and helps catching bugs due to mismatch parenthesis, for instance. In the PDE, you use the key combination: ctrl+t
  2. You copy and paste your code in the forum. Then you select the code and you hit the formatting button aka. the button with this symbol: </>

That’s it! Please notice you do not create a new post in case you need to format something you already posted. You can edit your post, copy the code to the PDE, indent the code properly there and then past it back here, format the code and >> save << the edits.

Extra info:

Formatting your code makes everybody’s life easier, your code looks much better plus it ensures your code integrity is not affected by the forum’s formatting (Do you know the forum processes markup code?) Please visit the sticky posts or the FAQ section/post to learn about this, other advantages and super powers you can get in this brand new forum.

Kf