#define MOT1DIR1 2
#define MOT1DOR2 3
#define MOT1PWM 4
int ledsw1 = 28;
int ledsw2 = 29;
int ledsw3 = 30;
int ledsw4 = 31;

void setup() {
  pinMode(ledsw1, INPUT);
  pinMode(ledsw2, INPUT);
  pinMode(ledsw3, INPUT);
  pinMode(ledsw4, INPUT);
  pinMode(MOT1DIR1, OUTPUT);
  pinMode(MOT1DOR2, OUTPUT);
  pinMode(MOT1PWM, OUTPUT);
}

void loop() {
  int ledsw1_onoff = digitalRead(ledsw1);
    int ledsw2_onoff = digitalRead(ledsw2);
      int ledsw3_onoff = digitalRead(ledsw3);
        int ledsw4_onoff = digitalRead(ledsw4);
  if (sw1_onoff == LOW)
  {
    digitalWrite(MOT1DIR1, HIGH);
    digitalWrite(MOT1DOR2, LOW); //시계방향
    digitalWrite(MOT1PWM, LOW);
    delay(2000);
    digitalWrite(MOT1PWM, HIGH);
    delay(100);
  }
  else if (sw2_onoff == LOW)
  {
    digitalWrite(MOT1DIR1, HIGH);
    digitalWrite(MOT1DOR2, LOW); //시계방향
    digitalWrite(MOT1PWM, LOW);
    delay(5000);
    digitalWrite(MOT1PWM, HIGH);
    delay(100);
  }
  else if (sw3_onoff == LOW)
  {
    digitalWrite(MOT1DIR1, LOW);
    digitalWrite(MOT1DOR2, HIGH); //반시계방향
    digitalWrite(MOT1PWM, LOW);
    delay(2000);
    digitalWrite(MOT1PWM, HIGH);
    delay(100);
  }
  else if (sw1_onoff == LOW)
  {
    digitalWrite(MOT1DIR1, LOW);
    digitalWrite(MOT1DOR2, HIGH); //반시계방향
    digitalWrite(MOT1PWM, LOW);
    delay(5000);
    digitalWrite(MOT1PWM, HIGH);
    delay(100);
  }

}