#include <EEPROM.h>
int alamatLed = 0;
int indexLed = 0;
int nilai = 0;
int led[3] = {2, 3, 4};
void setup(){
Serial.begin(115200);
pinMode(led[3], OUTPUT);
indexLed = EEPROM.read(alamatLed);
if(indexLed == 255){
EEPROM.write(alamatLed, 0);
indexLed = 0;
}
}
void loop(){
EEPROM.write(alamatLed, indexLed);
digitalWrite(led[indexLed], 1);
delay(500);
digitalWrite(led[indexLed], 0);
delay(500);
if(indexLed == 2){
indexLed = 0;
}
else{
indexLed = indexLed + 1;
}
Serial.println(indexLed);
}