//Dova Aditya
const int tombol = 2;
const int lampu = 5;

int buttonState = LOW; 
int ledState = -1; 

long lastDebounceTime = 0;  
long debounceDelay = 50;  

void setup() {
  pinMode(lampu, OUTPUT);
  pinMode(tombol, INPUT);
}

void loop() {
  buttonState = digitalRead(tombol);

  if ( (millis() - lastDebounceTime) > debounceDelay) {

    if ( (buttonState == HIGH) && (ledState < 0) ) {

      digitalWrite(lampu, HIGH); 
      ledState = -ledState; 
      lastDebounceTime = millis(); 
    }
    else if ( (buttonState == HIGH) && (ledState > 0) ) {

      digitalWrite(lampu, LOW); 
      ledState = -ledState; 
      lastDebounceTime = millis(); 
    }

  }//close if(time buffer)

}//close