กลับไปหน้ารวมไฟล์
working-with-two-leds-and-two-push-buttons-68eaa9.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


🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

Controlling one light is easy, but managing two introduces the concept of Simultaneous State Management. This project shows you how to program an Arduino to react to different inputs independently.

Interaction Modes

Typically, this project is programmed in two ways:

  1. Direct Mode: Button A turns on LED A. Button B turns on LED B.
  2. Opposite Mode: Button A turns on LED A but turns OFF LED B. This demonstrates how to create exclusive logic in your code.
  3. Toggle Mode: One tap of a button flips the state of its corresponding LED from ON to OFF and vice-versa.

Hardware List

  • Arduino Uno/Nano: The logic brain.
  • LEDs (Red and Green): Two independent visual outputs.
  • Push Buttons (x2): Two independent physical inputs.
  • 220-ohm Resistors (x2): For the LEDs.
  • 10k-ohm Resistors (x2): For the button pull-down circuits.

What You'll Learn

This project is essential for understanding Conditionals (if/else statements) and Debouncing. When you press a button, it doesn't just create one clean signal; it "bounces" electrical noise. Your code must learn to distinguish between a real press and interference, a skill that is vital for building any reliable user interface.

ข้อมูล 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"