const int SW12_PIN = 12; // GPIO pin connected to SW12
const int SW13_PIN = 13; // GPIO pin connected to SW13
const int SW14_PIN = 14; // GPIO pin connected to SW14
const int LED2_PIN = 2; // GPIO pin connected to LED2
const int LED4_PIN = 4; // GPIO pin connected to LED4
const int LED5_PIN = 5; // GPIO pin connected to LED5
void setup() {
pinMode(SW12_PIN, INPUT_PULLUP);
pinMode(SW13_PIN, INPUT_PULLUP);
pinMode(SW14_PIN, INPUT_PULLUP);
pinMode(LED2_PIN, OUTPUT);
pinMode(LED4_PIN, OUTPUT);
pinMode(LED5_PIN, OUTPUT);
}
void loop() {
// Check the state of SW12
if (digitalRead(SW12_PIN) == LOW) {
// If SW12 is pressed, turn off all LEDs
digitalWrite(LED2_PIN, LOW);
digitalWrite(LED4_PIN, LOW);
digitalWrite(LED5_PIN, LOW);
}
// Check the state of SW13
if (digitalRead(SW13_PIN) == LOW) {
// If SW13 is pressed, turn on all LEDs
digitalWrite(LED2_PIN, HIGH);
digitalWrite(LED4_PIN, HIGH);
digitalWrite(LED5_PIN, HIGH);
}
// Check the state of SW14
if (digitalRead(SW14_PIN) == LOW) {
// If SW14 is pressed, make LEDs flash
for (int i = 0; i < 10; i++) {
digitalWrite(LED2_PIN, HIGH);
digitalWrite(LED4_PIN, HIGH);
digitalWrite(LED5_PIN, HIGH);
delay(500); // Wait for 500ms (0.5 seconds)
digitalWrite(LED2_PIN, LOW);
digitalWrite(LED4_PIN, LOW);
digitalWrite(LED5_PIN, LOW);
delay(500); // Wait for 500ms (0.5 seconds)
}
}
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
r1:1
r1:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r2:1
r2:2
led2:A
led2:C
r3:1
r3:2
led4:A
led4:C
r4:1
r4:2
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
r5:1
r5:2
r6:1
r6:2