const int PIN_M = 6;
const int PIN_H = 5;
const int PIN_K = 4;
const int PIN_B = 3;
const int PIN_P = 2;
int arah = 1;
int indeksLed = 0;
void setup() {
// put your setup code here, to run once:
pinMode(PIN_M, OUTPUT);
pinMode(PIN_H, OUTPUT);
pinMode(PIN_K, OUTPUT);
pinMode(PIN_B, OUTPUT);
pinMode(PIN_P, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int PIN;
if (indeksLed == 2)
PIN = PIN_P;
else if (indeksLed == 1)
PIN = PIN_B;
else if (indeksLed == 0)
PIN = PIN_K;
else if (indeksLed == 4)
PIN = PIN_H;
else if (indeksLed == 3)
PIN = PIN_M;
digitalWrite(PIN, HIGH);
delay(500);
digitalWrite(PIN, LOW);
if (indeksLed == 5 )
arah = -1;
else if (indeksLed == 0)
arah = 1;
indeksLed = indeksLed + arah;
}