const byte LEDs[] = {15, 14, 16, 10, 9, 8, 7, 6}; // Pins for LEDs
const byte dipSwitchPins[] = {4, 5};  // Pins for dip switches

const int SHORT_PRESS_TIME = 1000; // 1000 milliseconds
const int LONG_PRESS_TIME  = 1000; // 1000 milliseconds


unsigned long pressedTime1  = 0;
unsigned long releasedTime1 = 0;
bool isPressing1 = false;
bool isLongDetected1 = false;

unsigned long pressedTime2  = 0;
unsigned long releasedTime2 = 0;
bool isPressing2 = false;
bool isLongDetected2 = false;

void setup() {
  Serial.begin(115200);
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);

  pinMode(dipSwitchPins[0], INPUT_PULLUP);  // Dip switch 1
  pinMode(dipSwitchPins[1], INPUT_PULLUP);  // Dip switch 2

}

void loop() {

  byte dipSwitchState = digitalRead(dipSwitchPins[0]) | (digitalRead(dipSwitchPins[1]) << 1);
  int channelNo = map(dipSwitchState, 0, 3, 1, 4);
  //Serial.println(channelNo);

  if (channelNo == 1) 
    digitalWrite(A0, HIGH);
    else digitalWrite(A0, LOW);
  
   if (channelNo == 2) 
    digitalWrite(A1, HIGH);
    else digitalWrite(A1, LOW);

     if (channelNo == 3) 
    digitalWrite(A2, HIGH);
    else digitalWrite(A2, LOW);

     if (channelNo == 4) 
    digitalWrite(A3, HIGH);
    else digitalWrite(A3, LOW);
}