const int ledPin = 4;
const int buttonPin = 7;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32-S2!");
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(buttonPin) == HIGH) {
blink();
}
Serial.println("nu draait de loop");
Serial.println((digitalRead(buttonPin)));
delay(1000);
}
void blink() {
for(int i = 0; i < 3; i++) {
digitalWrite(ledPin, HIGH);
delay(1000); // this speeds up the simulation
digitalWrite(ledPin, LOW);
delay(1000);
}
}