//github.com/dibyasn
// Toggling LEDs
// Define the pin numbers for the LEDs
#define LED1 10 // Pin 10 will control the first LED
#define LED2 5 // Pin 5 will control the second LED
void setup() {
// Initialize the LED pins as output
pinMode(LED1, OUTPUT); // Set pin 10 as an OUTPUT for LED1
pinMode(LED2, OUTPUT); // Set pin 5 as an OUTPUT for LED2
}
void loop() {
// Toggle the state of LED1 (turn it on if it's off, and off if it's on)
digitalWrite(LED1, !digitalRead(LED1)); // Read current state of LED1, invert it, and set the new state
delay(500); // Wait for 500 milliseconds (0.5 seconds)
// Toggle the state of LED2 (turn it on if it's off, and off if it's on)
digitalWrite(LED2, !digitalRead(LED2)); // Read current state of LED2, invert it, and set the new state
delay(500); // Wait for 500 milliseconds (0.5 seconds)
}