Back to Parent

// Define LED pins
int led1 = D10;  // External LED connected to D10
int led2 = D3;   // Onboard LED on D7

void setup() {
  // Set both pins as outputs
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
}

void loop() {
  // Turn on led1 and turn off led2
  digitalWrite(led1, HIGH);
  digitalWrite(led2, LOW);
  delay(300);  // Wait for 1 second

  // Turn off led1 and turn on led2
  digitalWrite(led1, LOW);
  digitalWrite(led2, HIGH);
  delay(300);  // Wait for 1 second
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0