Hello, I'm very new to programming and I'd like some help with my code. I've create a sketch to control 6 servos using a PCA9685. I attempted to use "If Statements" to prevent damaging the servos if one fails. The code I've created is not showing any errors when I verify it but if I upload it none of the servos move after I trigger the hall sensor. Help would be greatly appreciated as I'm down to 48hrs to finish this. Here is the code:

```
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
//Constants
#define nbPCAServo 16
#define Hall_Sensor_D 2 //D2 with digital output
//Parameters
int MIN_IMP [nbPCAServo] = {155, 155, 155, 180, 85, 85};
int MAX_IMP [nbPCAServo] = {625, 625, 625, 385, 495, 495};
int MIN_ANG [nbPCAServo] = {0, 0, 0, 0, 0, 0};
int MAX_ANG [nbPCAServo] = {120, 120, 90, 75, 160, 160};
#define FACEPLATE_CLOSED 0
#define FACEPLATE_OPEN 1
int facePlateCurMode = FACEPLATE_OPEN; // Keep track if the faceplate is open or closed
int Val2 = 0;
Adafruit_PWMServoDriver pca = Adafruit_PWMServoDriver(0x40);
uint8_t servonum = 6;
void setup() {
Serial.begin(9600);
pinMode(Hall_Sensor_D, INPUT_PULLUP);
Serial.println("Initialize System");
pca.begin();
pca.setPWMFreq(60);
}
void pcaScenarioOpen() {
pca.setPin(0, 0, false); // activate pin 0
pca.setPin(1, 0, false); // activate pin 1
pca.setPin(2, 0, false); // activate pin 2
pca.setPin(3, 0, false); // activate pin 3
pca.setPin(4, 0, false); // activate pin 4
pca.setPin(5, 0, false); // activate pin 5
for (int i = 0; i < nbPCAServo; i++) {
for (int pos = MAX_IMP[0]; MAX_IMP[0] > MIN_IMP[0]; MAX_IMP[i] -= 10)
for (int pos = MIN_IMP[1]; MIN_IMP[1] < MAX_IMP[1]; MIN_IMP[1] += 10) {//switch min and max of this servo
pca.writeMicroseconds(0, MAX_IMP[0]);
pca.writeMicroseconds(1, MIN_IMP[1]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MAX_IMP[0]);
if (int pos = MIN_IMP[1]);
}
pca.setPin(0, 0, true); // deactivate pin 0
pca.setPin(1, 0, true); // deactivate pin 1
for (int pos = MAX_IMP[2]; MAX_IMP[2] > MIN_IMP[2]; MAX_IMP[2] -= 10) {
pca.writeMicroseconds(2, MAX_IMP[2]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MAX_ANG[2]) {
pca.setPin(2, 0, true); // deactivate pin 2
}
for (int pos = MAX_IMP[3]; MAX_IMP[3] > MIN_IMP[3]; MAX_IMP[3] -= 10) {
pca.writeMicroseconds(3, MAX_IMP[3]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MAX_IMP[3]) {
pca.setPin(3, 0, true); // deactivate pin 3
}
for (int i = 0; i < nbPCAServo; i++) {
for (int pos = MAX_IMP[4]; MAX_IMP[4] > MIN_IMP[4]; MAX_IMP[i] -= 10)
for (int pos = MAX_IMP[5]; MAX_IMP[5] > MIN_IMP[5]; MAX_IMP[5] -= 10) {
pca.writeMicroseconds(4, MAX_IMP[4]);
pca.writeMicroseconds(5, MAX_IMP[5]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MAX_IMP[4]);
if (int pos = MAX_IMP[5]);
}
pca.setPin(4, 0, true); // deactivate pin 4
pca.setPin(5, 0, true); // deactivate pin 5
}
int jointToImp(double x, int i) { /* function jointToImp */
////Convert joint angle into pwm command value
int imp = (x - MIN_ANG[i]) * (MAX_IMP[i] - MIN_IMP[i]) / (MAX_ANG[i] - MIN_ANG[i]) + MIN_IMP[i];
imp = max(imp, MIN_IMP[i]);
imp = min(imp, MAX_IMP[i]);
return imp;
int facePlateCurMode = FACEPLATE_OPEN;
}
void pcaScenarioClose() {
pca.setPin(0, 0, false); // activate pin 0
pca.setPin(1, 0, false); // activate pin 1
pca.setPin(2, 0, false); // activate pin 2
pca.setPin(3, 0, false); // activate pin 3
pca.setPin(4, 0, false); // activate pin 4
pca.setPin(5, 0, false); // activate pin 5
for (int pos = MIN_IMP[0]; MIN_IMP[0] < MAX_IMP[0]; MIN_IMP[0] += 10)
for (int pos = MAX_IMP[1]; MAX_IMP[1] > MIN_IMP[1]; MAX_IMP[1] -= 10) {
pca.writeMicroseconds(0, MIN_IMP[0]);
pca.writeMicroseconds(1, MAX_IMP[1]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MIN_IMP[0]);
if (int pos = MAX_IMP[1]);
//if statement using the servos 4 & 5 IMP postion or use scenarios
pca.setPin(0, 0, true); // deactivate pin 0
pca.setPin(1, 0, true); // deactivate pin 1
for (int pos = MIN_IMP[2]; MIN_IMP[2] < MAX_IMP[2]; MIN_IMP[2] += 10) {
pca.writeMicroseconds(2, MIN_IMP[2]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MIN_ANG[2]) {
pca.setPin(2, 0, true); // deactivate pin 2
}
for (int pos = MIN_IMP[3]; MIN_IMP[3] < MAX_IMP[3]; MIN_IMP[3] += 10) {
pca.writeMicroseconds(3, MIN_IMP[3]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MIN_IMP[3])
pca.setPin(3, 0, true); // deactivate pin 3
for (int pos = MIN_IMP[4]; MIN_IMP[4] < MAX_IMP[4]; MIN_IMP[4] += 10)
for (int pos = MIN_IMP[5]; MIN_IMP[5] < MAX_IMP[5]; MIN_IMP[5] += 10) {
pca.writeMicroseconds(4, MIN_IMP[0]);
pca.writeMicroseconds(5, MIN_IMP[1]); delay(10);
}
servonum++; // Proceeds to next servo.
if (int pos = MIN_IMP[4]);
if (int pos = MIN_IMP[5]);
pca.setPin(4, 0, true); // deactivate pin 4
pca.setPin(5, 0, true); // deactivate pin 5
int facePlateCurMode = FACEPLATE_CLOSED;
}
void loop() {
Val2 = digitalRead(Hall_Sensor_D)
; Serial.println(Hall_Sensor_D);
if (Val2 == LOW) {
pcaScenarioOpen();
}
else {
pcaScenarioClose();
}
if (int facePlateCurMode = FACEPLATE_OPEN) {
pcaScenarioClose();
}
if (int facePlateCurMode = FACEPLATE_CLOSED) {
pcaScenarioOpen();
}
}
```