How do you plan to solve it?
To solve this task, I will connect an LED to one of the Arduino pins using a 300Ω resistor so that the current is about 10 mA. The resistor makes sure the LED does not get too much current. In the code, I will use digitalWrite
to turn the LED ON and OFF, and use delay
to control the time. The LED will stay ON for 400 ms and OFF for 800 ms, and this will keep repeating in the loop()
function.
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
delay(400);
digitalWrite(3, LOW);
delay(800);
When the program runs, the LED connected to pin 3 will blink continuously. It will turn ON for 400 milliseconds and then turn OFF for 800 milliseconds, repeating over and over. The 300Ω resistor makes sure that the LED only takes about 10 mA of current.
Add video of the output (know more)
Add a photo of your hardware showing the output.