const int leadframedetect_0 = 22;
const int leadframedetect_1 = 23;
const int leadframedetect_2 = 24;
const int leadframedetect_3 = 25;
const int leadframedetect_4 = 26;
const int leadframedetect_5 = 2;
const int leadframedetect_6 = 3;
const int leadframedetect_7 = 54;
const int pilot_led_0 = 36;
const int pilot_led_1 = 37;
const int pilot_led_2 = 38;
const int pilot_led_3 = 39;
const int pilot_led_4 = 40;
const int pilot_led_5 = 4;
const int pilot_led_6 = 5;
const int pilot_led_7 = 6;
const int pushbutton_resetFront = 60;
const int productdrop_error_front = 53;
const int leadframedetect_8 = 55;
const int leadframedetect_9 = 56;
const int leadframedetect_10 = 57;
const int leadframedetect_11 = 58;
const int leadframedetect_12 = 59;
const int leadframedetect_13 = 27;
const int leadframedetect_14 = 28;
const int leadframedetect_15 = 29;
const int pilot_led_8 = 41;
const int pilot_led_9 = 42;
const int pilot_led_10 = 43;
const int pilot_led_11 = 44;
const int pilot_led_12 = 45;
const int pilot_led_13 = 8;
const int pilot_led_14 = 9;
const int pilot_led_15 = 7;
const int pushbutton_resetBack = 61;
const int productdrop_error_back = 47;
void setup() {
pinMode(leadframedetect_0, INPUT);
pinMode(leadframedetect_1, INPUT);
pinMode(leadframedetect_2, INPUT);
pinMode(leadframedetect_3, INPUT);
pinMode(leadframedetect_4, INPUT);
pinMode(leadframedetect_5, INPUT);
pinMode(leadframedetect_6, INPUT);
pinMode(leadframedetect_7, INPUT);
pinMode(leadframedetect_8, INPUT);
pinMode(leadframedetect_9, INPUT);
pinMode(leadframedetect_10, INPUT);
pinMode(leadframedetect_11, INPUT);
pinMode(leadframedetect_12, INPUT);
pinMode(leadframedetect_13, INPUT);
pinMode(leadframedetect_14, INPUT);
pinMode(leadframedetect_15, INPUT);
pinMode(pushbutton_resetFront, INPUT);
pinMode(pushbutton_resetBack, INPUT);
pinMode(pilot_led_0, OUTPUT);
pinMode(pilot_led_1, OUTPUT);
pinMode(pilot_led_2, OUTPUT);
pinMode(pilot_led_3, OUTPUT);
pinMode(pilot_led_4, OUTPUT);
pinMode(pilot_led_5, OUTPUT);
pinMode(pilot_led_6, OUTPUT);
pinMode(pilot_led_7, OUTPUT);
pinMode(pilot_led_8, OUTPUT);
pinMode(pilot_led_9, OUTPUT);
pinMode(pilot_led_10, OUTPUT);
pinMode(pilot_led_11, OUTPUT);
pinMode(pilot_led_12, OUTPUT);
pinMode(pilot_led_13, OUTPUT);
pinMode(pilot_led_14, OUTPUT);
pinMode(pilot_led_15, OUTPUT);
pinMode(productdrop_error_front, OUTPUT);
pinMode(productdrop_error_back, OUTPUT);
}
void loop() {
if (digitalRead(leadframedetect_0) == HIGH || digitalRead(leadframedetect_1) == HIGH || digitalRead(leadframedetect_2) == HIGH ||
digitalRead(leadframedetect_3) == HIGH || digitalRead(leadframedetect_4) == HIGH || digitalRead(leadframedetect_5) == HIGH ||
digitalRead(leadframedetect_6) == HIGH || digitalRead(leadframedetect_7) == HIGH) {
digitalWrite(productdrop_error_front, HIGH);
}
if (digitalRead(leadframedetect_0) == HIGH) {
digitalWrite(pilot_led_0, HIGH);
}
if (digitalRead(leadframedetect_1) == HIGH) {
digitalWrite(pilot_led_1, HIGH);
}
if (digitalRead(leadframedetect_2) == HIGH) {
digitalWrite(pilot_led_2, HIGH);
}
if (digitalRead(leadframedetect_3) == HIGH) {
digitalWrite(pilot_led_3, HIGH);
}
if (digitalRead(leadframedetect_4) == HIGH) {
digitalWrite(pilot_led_4, HIGH);
}
if (digitalRead(leadframedetect_5) == HIGH) {
digitalWrite(pilot_led_5, HIGH);
}
if (digitalRead(leadframedetect_6) == HIGH) {
digitalWrite(pilot_led_6, HIGH);
}
if (digitalRead(leadframedetect_7) == HIGH) { // Check if Pin 54 is HIGH
digitalWrite(pilot_led_7, HIGH); // Turn on Pin 6
}
if (digitalRead(pushbutton_resetFront) == HIGH) { // Check if pushbutton on A14 is pressed
digitalWrite(pilot_led_0, LOW); // Turn off Pin 36
digitalWrite(pilot_led_1, LOW); // Turn off Pin 37
digitalWrite(pilot_led_2, LOW); // Turn off Pin 38
digitalWrite(pilot_led_3, LOW); // Turn off Pin 39
digitalWrite(pilot_led_4, LOW); // Turn off Pin 40
digitalWrite(pilot_led_5, LOW); // Turn off Pin 4
digitalWrite(pilot_led_6, LOW); // Turn off Pin 5
digitalWrite(pilot_led_7, LOW); // Turn off Pin 6
digitalWrite(productdrop_error_front, LOW); // Turn off Pin 53
}
if (digitalRead(leadframedetect_8) == HIGH || digitalRead(leadframedetect_9) == HIGH || digitalRead(leadframedetect_10) == HIGH ||
digitalRead(leadframedetect_11) == HIGH || digitalRead(leadframedetect_12) == HIGH || digitalRead(leadframedetect_13) == HIGH ||
digitalRead(leadframedetect_14) == HIGH || digitalRead(leadframedetect_15) == HIGH) {
digitalWrite(productdrop_error_back, HIGH);
}
if (digitalRead(leadframedetect_8) == HIGH) {
digitalWrite(pilot_led_8, HIGH);
}
if (digitalRead(leadframedetect_9) == HIGH) {
digitalWrite(pilot_led_9, HIGH);
}
if (digitalRead(leadframedetect_10) == HIGH) {
digitalWrite(pilot_led_10, HIGH);
}
if (digitalRead(leadframedetect_11) == HIGH) {
digitalWrite(pilot_led_11, HIGH);
}
if (digitalRead(leadframedetect_12) == HIGH) {
digitalWrite(pilot_led_12, HIGH);
}
if (digitalRead(leadframedetect_13) == HIGH) {
digitalWrite(pilot_led_13, HIGH);
}
if (digitalRead(leadframedetect_14) == HIGH) {
digitalWrite(pilot_led_14, HIGH);
}
if (digitalRead(leadframedetect_15) == HIGH) {
digitalWrite(pilot_led_15, HIGH);
}
if (digitalRead(pushbutton_resetBack) == HIGH) { // Check if pushbutton on A14 is pressed
digitalWrite(pilot_led_8, LOW); // Turn off Pin 36
digitalWrite(pilot_led_9, LOW); // Turn off Pin 37
digitalWrite(pilot_led_10, LOW); // Turn off Pin 38
digitalWrite(pilot_led_11, LOW); // Turn off Pin 39
digitalWrite(pilot_led_12, LOW); // Turn off Pin 40
digitalWrite(pilot_led_13, LOW); // Turn off Pin 4
digitalWrite(pilot_led_14, LOW); // Turn off Pin 5
digitalWrite(pilot_led_15, LOW); // Turn off Pin 6
digitalWrite(productdrop_error_back, LOW); // Turn off Pin 53
}
}