All submissions

Solving Approach

How do you plan to solve it?

 To protect the LED, we calculate the series resistor using Ohm’s Law. With a 5V supply, LED forward voltage around 2V, and desired current of 10 mA, the resistor is about 300 Ω. Finally, we check that the resistor’s power rating is safe and that the GPIO pin can handle the current.
 

 

 

 

Code

// Define LED pin
int ledPin = 13;  // You can change this to the GPIO pin you connected the LED

void setup() {
  // Set LED pin as output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH); // Turn LED ON
  delay(1000);                // Wait 1 second
  digitalWrite(ledPin, LOW);  // Turn LED OFF
  delay(1000);                // Wait 1 second
}

 

 

 

Output

Video

Add video of the output (know more)

 

 

Photo of Output

 

 

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!