Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Pushbutton LED Control Circuit

View and Edit Project In Cirkit DesignerImage of Arduino UNO Pushbutton LED Control Circuit

Circuit Documentation

Summary of the Circuit

This circuit is designed around an Arduino UNO microcontroller and includes a pushbutton, two resistors, and a red two-pin LED. The pushbutton is used to input a signal to the Arduino, which then controls the LED based on the button's state. The resistors are used to limit current: one is connected to the pushbutton and the other is in series with the LED. The Arduino UNO reads the state of the pushbutton and outputs a signal to the LED, turning it on or off accordingly.

Component List

Arduino UNO

LED: Two Pin (red)

Pushbutton

Resistor (10k Ohms)

Wiring Details

Arduino UNO

LED: Two Pin (red)

Pushbutton

Resistor (10k Ohms)

Documented Code

// Define pin connections
int LEDPin = 8;      // LED connected to digital pin 8
int buttonPin = 12;   // Button connected to digital pin 12
int buttonRead;       // Variable to store button state
int DelayTime = 500;  // Delay time in milliseconds

// Setup function runs once at the start
void setup() {
  Serial.begin(9600);          // Start serial communication at 9600 baud
  pinMode(LEDPin, OUTPUT);     // Set LED pin as an output
  pinMode(buttonPin, INPUT);   // Set button pin as an input
}

// Loop function runs repeatedly
void loop() {
  buttonRead = digitalRead(buttonPin);  // Read the button state
  Serial.println(buttonRead);           // Print the button state to the serial monitor
  delay(DelayTime);                     // Wait for a specified time
}

The code sets up the Arduino UNO to read the state of the pushbutton and print it to the serial monitor. The LED is controlled by the digital pin 8, and the pushbutton state is read from digital pin 12. The DelayTime variable introduces a half-second delay between each read of the button state.