กลับไปหน้ารวมไฟล์
working-with-two-leds-and-two-push-buttons-68eaa9-en.md

This project demonstrates the use of two LEDs along with two Push Buttons.

Objective

For one set of LED and the Push button, when button is pressed LED is set ON and when the button is released, LED will be set OFF. for the other set, its the opposite effect.

Working with two LEDs and two PUSH BUTTONs

Introduction to Logic States

The Dual Button LED Controller is more than just a lighting project—it's an experiment in "Inverted Logic" and parallel sensing. By using two separate buttons to control two different LEDs in opposing ways, the user learns how to manipulate digital states—HIGH and LOW—to achieve different physical behaviors. This is the foundational logic used in manufacturing safety switches and interactive interfaces.

Hardware Infrastructure

  • Arduino UNO: The central logic chip that monitors the inputs and drives the outputs simultaneously.
  • LEDs (x2): These act as the visual indicators for the two different logic states.
  • Push Buttons (x2): Momentary tactile switches that serve as the human inputs.
  • Resistors (x4):
    • Two resistors act as current-limiters for the LEDs.
    • Two resistors act as "Pull-Down" or "Pull-Up" resistors for the buttons, ensuring the Arduino doesn't get "floating" signals when the buttons aren't pressed.
  • Breadboard: Provides the structure needed to keep the two independent circuits organized.

Comparative Control Logic

The Arduino code runs two independent logic checks inside a high-speed loop:

  1. Direct Mode (LED 1):
    • Action: Button 1 is pressed (HIGH).
    • Result: LED 1 turns ON.
    • Logic: Direct relationship (Output = Input).
  2. Inverted Mode (LED 2):
    • Action: Button 2 is pressed (HIGH).
    • Result: LED 2 turns OFF.
    • Logic: Inverse relationship (Output = NOT Input). If the button is not pressed, the LED remains on.

Educational Value and Flexibility

This project is an excellent introduction to Boolean Operators (NOT, AND, OR). It teaches builders that code doesn't just copy a button's state; it can transform it. Once understood, this logic can be scaled to create "Safety Interlocks" (where an appliance only turns off when a button is hit) or toggle switches (where one press turns it on and a second press turns it off).

ข้อมูล Frontmatter ดั้งเดิม

title: "Working with two LEDs and two PUSH BUTTONs"
description: "This project illustrates the use of two PUSH BUTTONS to operate two LEDs"
author: "SBR"
category: ""
tags:
  - "learning"
  - "starter"
  - "beginner"
views: 101601
likes: 19
price: 299
difficulty: "Easy"
components:
  - "4x Resistor 1k ohm"
  - "1x Arduino UNO"
  - "2x LED (generic)"
  - "10x Jumper wires (generic)"
  - "2x Tactile Switch, Top Actuated"
  - "1x Breadboard (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "13258e3c2562764d9453dee304f8f449804f6b5c87719d195a0ba4a2aacb189d"
encryptedPayload: "U2FsdGVkX199pVCGItSn6lDoQa0sFUamlLbleW2Rkpm9UQ/ZPUsaOs2xIz8dgSUkJJNrnnnQkJgLzfd0MMb8Ld/7FjhZfx2o6JlsPxQ8hFG4qQgb5kYVNo43H0+nw8g/Ow4Q3njbIwSjJmiofSMcDg=="
seoDescription: "Learn how to control two LEDs using two PUSH BUTTONs with Arduino. A simple, step-by-step guide for beginners."
videoLinks:
  - "https://www.youtube.com/embed/7RZqJGDX2iE"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/working-with-two-leds-and-two-push-buttons-68eaa9_cover.jpg"
lang: "en"