#include <Arduino.h>
#define LedPin1 2
#define LedPin2 3
#define LedPin3 4
#define LedPin4 5
#define ButtonPin1 8
#define ButtonPin2 9
#define ButtonPin3 10
#define ButtonPin4 11
int ledStatus = 0;
void setup() {
pinMode(ButtonPin1, INPUT_PULLUP);
pinMode(LedPin1, OUTPUT);
pinMode(ButtonPin2, INPUT_PULLUP);
pinMode(LedPin2, OUTPUT);
pinMode(ButtonPin3, INPUT_PULLUP);
pinMode(LedPin3, OUTPUT);
pinMode(ButtonPin4, INPUT_PULLUP);
pinMode(LedPin4, OUTPUT);
}
void loop () {
if (digitalRead(ButtonPin1) == LOW) {
ledStatus = !ledStatus;
digitalWrite (LedPin1, ledStatus);
delay(2000);
}
if (digitalRead(ButtonPin2) == LOW) {
ledStatus = !ledStatus;
digitalWrite (LedPin2, ledStatus);
delay(2000);
}
if (digitalRead(ButtonPin3) == LOW) {
ledStatus = !ledStatus;
digitalWrite (LedPin3, ledStatus);
delay(2000);
}
if (digitalRead(ButtonPin4) == LOW) {
ledStatus = !ledStatus;
digitalWrite (LedPin4, ledStatus);
delay(2000);
}
}