1. Circuit Setup:
Connect an LED in series with a resistor to a microcontroller GPIO pin.
The resistor value is chosen so that only ~10 mA flows through the LED.
Assuming a 5 V GPIO, LED forward voltage of ~2 V, and desired current of 10 mA:
R = \frac{5V - 2V}{0.01A} = 300 \, \Omega
2. Code Logic:
Configure the LED pin as output.
Turn LED ON for 400 ms.
Turn LED OFF for 800 ms.
Repeat continuously in a loop.
3. Expected Behavior:
The LED blinks with ON-time shorter than OFF-time.
This creates a visible blink pattern (400 ms ON, 800 ms OFF).
/*Paste your code here*/
// LED Blink Task
// LED connected to pin 13 (or any GPIO)
int ledPin = 13; // GPIO pin for LED
void setup() {
pinMode(ledPin, OUTPUT); // set LED pin as output
}
void loop() {
digitalWrite(ledPin, HIGH); // turn LED ON
delay(400); // wait 400 ms
digitalWrite(ledPin, LOW); // turn LED OFF
delay(800); // wait 800 ms
}
The LED turns ON for 400 ms, OFF for 800 ms, continuously.