const int btnPin=17;
const int ledPin=39;
void setup() {
// put your setup code here, to run once:
pinMode(btnPin,INPUT_PULLUP);
pinMode(ledPin,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(digitalRead(btnPin));
if(digitalRead(btnPin)==LOW) digitalWrite(ledPin,LOW);
else digitalWrite(ledPin,HIGH);
}
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1