Circuit Documentation
Summary
This circuit is designed to control an LED using a pushbutton and an Arduino UNO. When the pushbutton is pressed, the LED will blink. The circuit includes an Arduino UNO, a resistor, a red LED, and a pushbutton.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Resistor
- Description: A 220 Ohm resistor.
- Pins: pin1, pin2
- Properties:
- Resistance: 220 Ohms
LED: Two Pin (red)
- Description: A red LED with two pins.
- Pins: cathode, anode
Pushbutton
- Description: A pushbutton with four pins.
- Pins: Pin 1 (in), Pin 2 (in), Pin 3 (out), Pin 4 (out)
Wiring Details
Arduino UNO
- 5V is connected to pin1 of the Resistor.
- GND is connected to cathode of the LED.
- D2 is connected to Pin 2 (in) of the Pushbutton and pin2 of the Resistor.
- D4 is connected to Pin 4 (out) of the Pushbutton and anode of the LED.
Resistor
- pin1 is connected to 5V of the Arduino UNO.
- pin2 is connected to Pin 2 (in) of the Pushbutton and D2 of the Arduino UNO.
LED: Two Pin (red)
- cathode is connected to GND of the Arduino UNO.
- anode is connected to Pin 4 (out) of the Pushbutton and D4 of the Arduino UNO.
Pushbutton
- Pin 1 (in) is not connected.
- Pin 2 (in) is connected to pin2 of the Resistor and D2 of the Arduino UNO.
- Pin 3 (out) is not connected.
- Pin 4 (out) is connected to anode of the LED and D4 of the Arduino UNO.
Code Documentation
Arduino UNO Code
int button = 0;
void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
button = digitalRead(2);
Serial.println(button);
if (button == LOW) {
digitalWrite(4, LOW);
} else {
digitalWrite(4, HIGH);
delay(250);
digitalWrite(4, LOW);
delay(250);
}
}
LED: Two Pin (red) Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used in the microcontrollers.
