#define PIN_SWITCH 2
#define PIN_RELAY 3

void setup() {
  // put your setup code here, to run once:
  pinMode(PIN_SWITCH, INPUT_PULLUP);
  pinMode(PIN_RELAY, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if ( digitalRead(PIN_SWITCH) == 0 ) {
    digitalWrite(PIN_RELAY, HIGH);
  } else {
    digitalWrite(PIN_RELAY, LOW);
  }
}