#define POSITION_NUM 4
#define ON LOW
#define OFF HIGH

// Define the pins connected to the dip switch
const int SWITCH_PINS[] = {26, 27, 14, 12};

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  
  // Set the dip switch pins as inputs with pull-up resistors enabled
  for (int i = 0; i < POSITION_NUM; i++)
    pinMode(SWITCH_PINS[i], INPUT_PULLUP);
}

void loop() {
  // put your main code here, to run repeatedly:
  
  // Read the state of each switch position
  for (int i = 0; i < POSITION_NUM; i++) {
    Serial.print("Position ");
    Serial.print(i+1);
    Serial.print(": ");
    int state = digitalRead(SWITCH_PINS[i]);

    if (state == ON)
      Serial.println("ON");
    else
      Serial.println(("OFF"));
  }
  
  Serial.println();

  // add a delay to prenvent rapid reading
  delay(500);
}