const int LED1 = 2; // LED connected to digital pin 2
const int LED2 = 3; // LED connected to digital pin 3
const int LED3 = 4; // LED connected to digital pin 4
const int LED4 = 5; // LED connected to digital pin 5
void setup() {
// Set the four LED pins as outputs
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
}
void loop() {
// Turn on LED1 and LED3
digitalWrite(LED1, HIGH);
digitalWrite(LED3, HIGH);
// Turn off LED2 and LED4
digitalWrite(LED2, LOW);
digitalWrite(LED4, LOW);
// Wait for 500 ms
delay(500);
// Turn on LED2 and LED4
digitalWrite(LED2, HIGH);
digitalWrite(LED4, HIGH);
// Turn off LED1 and LED3
digitalWrite(LED1, LOW);
digitalWrite(LED3, LOW);
// Wait for 500 ms
delay(500);
}