Solving Approach

Considering that:

  • the no-current output pin voltage is 5V and its internal resistance 25 Ohm (from the data sheet)
  • The forward voltage of the LED is 1.5V

The total series resistance of the circuit for a current of 10mA is (5-1.5)/0.01 = 350 Ohm.

Since the internal resistance of the output is 25 Ohm, the external resistor should be 325 Ohm.

A 330 Ohm resistor from the E12 series of preferred values will work, giving a current slightly below 10mA.
 

Code

// Simple implementation using the standard delay() function.
// This code uses a blocking functions, halting all other operations during the delays.
// A better approach would be to use a non-blocking timer interrupt approach.

// Define the pin the LED is connected to.
#define LED_PIN 13

// Define the ON and OFF durations in milliseconds.
const int ON_DURATION_MS = 400;  // LED stays ON for 400ms
const int OFF_DURATION_MS = 800; // LED stays OFF for 800ms

void setup() {
  // Set the LED pin as an output.
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(ON_DURATION_MS);
  digitalWrite(LED_PIN, LOW);
  delay(OFF_DURATION_MS);
}

 

 

 

Output

Video

Add video of the output (know more)

 

 

Photo of Output

IMG_1849

 

 

Upvote
Downvote

Submit Your Solution

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