Servoarray doesn't work

Hi,
While learning the Arduino I wrote a little program using arrays.
I have a button array, a LED array and a servo array. LED 0 follows Button 0, LED 1 follows Button 1 etc..
For some reason the servo’s don’t follow. There must be something wrong with my code. Can someone tell me what’s wrong?

#include <Servo.h>

int ButtonArray[] = {30,31,32,33};    
int LedArray[]= {40,41,42,43};       
int Number = 4;
Servo ServoArray[4];

int buttonStateArray[4];         
int lastButtonStateArray[4];     

void setup() {
  int i;
   
  for (i=0;i<Number;i++){
    pinMode(ButtonArray[i], INPUT); 
    pinMode(LedArray[i], OUTPUT); 
    buttonStateArray[i] = 0;
    lastButtonStateArray[i] = 0;
  }
  for (uint8_t i=0;i<Number;i++)
    ServoArray[i].attach(22+i, 700, 2300); 
}

void loop() {
  int i;
  
  for (i=0;i<Number;i++){
    buttonStateArray[i] = digitalRead(ButtonArray[i]);
    if (buttonStateArray[i] != lastButtonStateArray[i]) {
      if (buttonStateArray[i] == HIGH) {
        digitalWrite(LedArray[i], LOW);
        ServoArray[i].writeMicroseconds(700);
      } 
      else {
        digitalWrite(LedArray[i], HIGH);
      }  
      lastButtonStateArray[i] = buttonStateArray[i];
      ServoArray[i].writeMicroseconds(2300);
    }  
  }
}

Thanks,
Chris

Your LED action does not match your Servo action.
Regardless of the button-press, you always write the servo position to be 2300.

#include <Servo.h>

int ButtonArray[] = {30,31,32,33};    
int LedArray[]= {40,41,42,43};       
int Number = 4;
Servo ServoArray[4];

int buttonStateArray[4];         
int lastButtonStateArray[4];     

void setup() {
  int i;
   
  for (i=0;i<Number;i++){
    pinMode(ButtonArray[i], INPUT); 
    pinMode(LedArray[i], OUTPUT); 
    buttonStateArray[i] = 0;
    lastButtonStateArray[i] = 0;
  }
  for (uint8_t i=0;i<Number;i++)
    ServoArray[i].attach(22+i, 700, 2300); 
}

void loop() {
  int i;
  
  for (i=0;i<Number;i++){
    buttonStateArray[i] = digitalRead(ButtonArray[i]);
    if (buttonStateArray[i] != lastButtonStateArray[i]) {
      if (buttonStateArray[i] == HIGH) {
        digitalWrite(LedArray[i], LOW);
        ServoArray[i].writeMicroseconds(700);
      } 
      else {
        digitalWrite(LedArray[i], HIGH);
        ServoArray[i].writeMicroseconds(2300);
      }  
      lastButtonStateArray[i] = buttonStateArray[i];
    }  
  }
}

Aaaarrrg, it all came down to a simple If Then mistake. I was to focused on the array and the declaration to see it. Like you said, there’s no way the servo could end in the 700 position.

Thanks for the quick reply AWOL, It works (of course).
Chris