int pb = 13;
int lampu1 = 12;
int lampu2 = 14;
// int counter;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(pb, INPUT);
  pinMode(lampu1, OUTPUT);
  pinMode(lampu2, OUTPUT);
  Serial.println("[email protected]");
}

void loop() {
   int status = digitalRead(pb);
   if (status==HIGH ) {
    digitalWrite(lampu1, HIGH);
    delay(100);
    digitalWrite(lampu1, LOW);
    delay(100);
    digitalWrite(lampu2, HIGH);
    delay(100);
    digitalWrite(lampu2, LOW);
    delay(100);
   
   }
}
  // delay(100); // delay opsional untuk mengurangi kemungkinan bouncing


  // put your main code here, to run repeatedly:

  // delay(10); // this speeds up the simulation

Loading
esp32-devkit-v1