int sw1, sw2, sw3, sw4, sw5,
    stat1,stat2,stat3,stat4,stat5,
    step;
  

#define buzzer 2
#define kiri 3
#define depan 4
#define kanan 5

void setup() 
{
  Serial.begin(9600);
  pinMode(A0, INPUT_PULLUP);
  pinMode(A1, INPUT_PULLUP);
  pinMode(A2, INPUT_PULLUP);
  pinMode(A3, INPUT_PULLUP);
  pinMode(A4, INPUT_PULLUP);

  pinMode(buzzer, OUTPUT);

  pinMode(kiri, OUTPUT);
  pinMode(depan, OUTPUT);
  pinMode(kanan, OUTPUT);
}

void loop() 
{
  sensor();
  sw1 = analogRead(A0);
  sw2 = analogRead(A1);
  sw3 = analogRead(A2);
  sw4 = analogRead(A3);
  sw5 = analogRead(A4);

  if(sw1 == 0)
  {
    stat1 = 1;
  }

  if(sw2 == 0)
  {
    stat2 = 1;
  }

  if(sw3 == 0)
  {
    stat3 = 1;
  }

  if(sw4 == 0)
  {
    stat4 = 1;
  }

  if(sw5 == 0)
  {
    stat5 = 1;
  }

  if(stat5 == 1)
  {
    if(stat1 == 1)
    {
      checkpoint0();
    }

    if(stat2 == 1)
    {
      checkpoint1();
    }

    if(stat3 == 1)
    {
      checkpoint2();
    }

    if(stat4 == 1)
    {
      checkpoint3();
    }
  }

  Serial.println(String(stat1) + " | " + String(stat2) + " | " + String(stat3) + " | " + String(stat4) + " | " + String(stat5));
  delay(500);

}
void sensor()
{

}

void checkpoint0()
{
  sensor();
  for(int i = 0; i <= 4; i++)
  {
    digitalWrite(depan,1);
    delay(100);
    digitalWrite(depan,0);
    delay(100);
  }
  
  

  tone(buzzer, 262, 500);
  delay(500);
  tone(buzzer, 0, 500);
  delay(500);
}

void checkpoint1()
{
  tone(buzzer, 262, 1000);
  delay(1000);
  tone(buzzer, 0, 1000);
  delay(1000);
}

void checkpoint2()
{
  tone(buzzer, 262, 1500);
  delay(1500);
  tone(buzzer, 0, 1500);
  delay(1500);
}

void checkpoint3()
{
  tone(buzzer, 262, 2000);
  delay(2000);
  tone(buzzer, 0, 2000);
  delay(2000);
}