// Anode = small , Cathode = big , resistor is always connected to anode
//and cathode is connected to grnd
// Btn of One end is connected to vcc and another to pin 4 and same to the gnd via
// resistor.
int led =2;
int btn =4;
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(4, INPUT);
Serial.begin(115200);
// Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
if(digitalRead(4)==HIGH){
digitalWrite(2, HIGH);
//Serial.println("LED IS ON ..");
delay(500);
}
else{
digitalWrite(2,LOW);
}
}