MUX Shield II photo resistor & Servo

Hello, Im trying to test using one photo resistor sensor to control a couple servos, before I scale up to use many of photo-resistors to control many servos. This code below isnt working. I cant tell if its a code issue or the electronics. If the code looks good then I’ll post the hardware somewhere else.

#include <MuxShield.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
MuxShield muxShield;

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

#define SERVOMIN  150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  600 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

// variables:  
int sensorValue;         // the sensor value
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value

void setup() {
  
  muxShield.setMode(1,ANALOG_IN);   //set I/O 1 as analog input
 Serial.begin(28800);
 
 ////////////////////////
 //calibratoin_code
 /////////////////////////
  // turn on LED to signal the start of the calibration period:
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

  // calibrate during the first five seconds //0000000
  while (millis() < 5000) {
    sensorValue = muxShield.analogReadMS(1,1);
    // record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = sensorValue;
    }
    // record the minimum sensor value
    if (sensorValue  < sensorMin) {
      sensorMin = sensorValue;
    }
  }

  // signal the end of the calibration period
  digitalWrite(13, LOW);
  //end_calibation_code
///////////////////////////////////////
  Serial.begin(9600);
  Serial.println("16 channel Servo test!");
  pwm.begin();
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates
}

///////////////////////////
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000;
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}
/////////////////////////////

void loop() {
// read the sensor: 00000000
  sensorValue  = muxShield.analogReadMS(1,1);;
  // apply the calibration to the sensor reading
  sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 180);
  // in case the sensor value is outside the range seen during calibration
  sensorValue = constrain(sensorValue, 0, 180);
  
 ///////////////  open during fondul
  if (sensorValue < 150  ) {
    pwm.setPWM(1, 0, map(180, 0, 180, SERVOMIN, SERVOMAX));
  }
  if (sensorValue > 150  ) {
    pwm.setPWM(1, 0, map(10, 0, 180, SERVOMIN, SERVOMAX));
  }
      
  ////////////////////////////

  if (sensorValue < 150  ) {
    pwm.setPWM(0, 0, map(180, 0, 180, SERVOMIN, SERVOMAX));
  }
  if (sensorValue > 150  ) {
    pwm.setPWM(0, 0, map(10, 0, 180, SERVOMIN, SERVOMAX));
  } 
      ////////////////////////
    delay(20);   
}

I’v solved the issue here is the revised code

#include <MuxShield.h>
MuxShield muxShield;
/////////////
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN  150 
#define SERVOMAX  600
uint8_t servonum = 0;
int myPhotoRis[] = {0,1,2,3,4,5,6,14,15} ;
int sensorValue []= {0,1,2,3}; 
int sensorMin = 1023;
int sensorMax = 0; 
void setup()
{
    //Set I/O 1, I/O 2, and I/O 3 as analog inputs
    muxShield.setMode(1,ANALOG_IN);
    Serial.begin(28800);
    /////////  
 //calibratoin_code
 /////////////////////////
  // turn on LED to signal the start of the calibration period:
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

  // calibrate during the first five seconds //0000000
  while (millis() < 5000) {
    sensorValue [0] = muxShield.analogReadMS(1,0);;

    // record the maximum sensor value
    if (sensorValue [0] > sensorMax) {
      sensorMax = sensorValue [0];
    }

    // record the minimum sensor value
    if (sensorValue [0] < sensorMin) {
      sensorMin = sensorValue [0];
    }
  }
  
  // signal the end of the calibration period
  digitalWrite(13, LOW);
  //end_calibation_code
//////////////////////////////////////////
   pwm.begin();
   pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates
}


///////////////
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000;
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}
///////////////

void loop() {
// read the sensor: 00000000
  sensorValue [0] = muxShield.analogReadMS(1,0);
  // apply the calibration to the sensor reading
  sensorValue [0]= map(sensorValue[0], sensorMin, sensorMax, 0, 180);
  // in case the sensor value is outside the range seen during calibration
  sensorValue[0] = constrain(sensorValue[0], 0, 180);
  


  
///////////light
//analogWrite(ledPin, 230);
   
 ///////////////  open during fondul
  if (sensorValue [0] < 150  ) {
    pwm.setPWM(1, 0, map(180, 0, 180, SERVOMIN, SERVOMAX));
  }
  if (sensorValue [0] > 150  ) {
    pwm.setPWM(1, 0, map(10, 0, 180, SERVOMIN, SERVOMAX));
  }
}