const int led = 40;
const int button = 10;
void setup() {
// put your setup code here, to run once:
pinMode(led, OUTPUT);
pinMode(button, INPUT_PULLUP);
Serial.begin(115200);
Serial.println("Hello, ESP32-S2!");
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(button) == HIGH){
digitalWrite(LED_BUILTIN, HIGH);
//digitalWrite(led, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
//digitalWrite(led, LOW);
delay(250);
Serial.println("Button is pressed now");
}else{
digitalWrite(led, LOW);
Serial.println("Button is not pressed!");
delay(1000);
}
//delay(10); // this speeds up the simulation
}