This circuit consists of an Arduino UNO microcontroller, a red two-pin LED, and a resistor. The purpose of the circuit is to blink the LED on and off at a one-second interval. The Arduino UNO is programmed to provide a digital output signal that alternates between high and low states, driving the LED through a current-limiting resistor.
// Define the pin for the LED
const int ledPin = 9;
void setup() {
// Set the LED pin as an OUTPUT
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED on
digitalWrite(ledPin, HIGH);
// Wait for 1 second
delay(1000);
// Turn the LED off
digitalWrite(ledPin, LOW);
// Wait for 1 second
delay(1000);
}
Filename: sketch.ino
The code is written for the Arduino UNO microcontroller. It defines the LED pin as digital pin 9 and sets it as an output in the setup()
function. The loop()
function turns the LED on by setting the pin high, waits for one second, turns the LED off by setting the pin low, and then waits for another second. This cycle repeats indefinitely, causing the LED to blink.