Button led — ESP32 simulation

An interactive ESP32 circuit simulation you can run free in your browser on Velxio, by bhuviperiyasamy47.

Components

Sketch code

void setup()
{
  pinMode(4,OUTPUT);
  pinMode(5,INPUT_PULLUP);
}
void loop()
{
  if(digitalRead(5) == LOW)//If button pressed low-led on because of pull up resistor enabled.without the input_pullup the input is on floating state .either 0 or 1 . 
  {
    digitalWrite(4,HIGH);
    
  }
  else
  {
    digitalWrite(4,LOW);
    
  }
}

More projects by bhuviperiyasamy47