Skip to content

Project 1.3.2: TWIN LIGHT

Description Twin Light is an engaging Arduino project that demonstrates dual LED control through a push-button interface. Pressing the (one) button activates two LEDs, and releasing the button turns off the LEDs at the same time.
Use case Twin Light can be applied as a personalized entryway indicator. Mount one LED outside and another inside a room. Pressing the button by the door lights up the external LED, signaling someone's presence. Releasing the button turns off the LED. Simultaneously, the internal LED mirrors the behavior, enabling those inside to confirm someone's arrival. This project showcases a creative way to communicate events through a simple user interaction.

Components (Things You will need)

LED Arduino Uno Arduino USB Cable Breadboard Push Button Resistor

Building the circuit

Things Needed:

  • Arduino Uno = 1
  • Arduino USB cable = 1
  • Resistor = 1
  • Push button = 1
  • Red LED = 1
  • Red jumper wires = 1
  • Black jumper wires = 1
  • Yellow jumper wires = 1
  • Blue jumper wires = 1

Mounting the component on the breadboard

Push Button = 1

Before we start the project let's understand the terminals of the LED and how it is being connected.

Step 1: Connect the Pushbutton on the breadboard but make sure the two pairs of the pins are connected on each side of the bridge.

Push Button 2.1.

Step 2: Inset two (2) LEDs on the breadboard as shown in the picture below.

Push Button 2.2.

WIRING THE CIRCUIT

Things Needed:

  • Red male-male-to-male jumper wires = 1
  • Black male-to-male jumper wires = 1
  • Yellow male-to-male jumper wires = 1
  • Blue male-to-male jumper wires = 1
  • White male-to-male jumper wires = 1
  • Green male-to-male jumper wires = 1

Step 3: Connect the Yellow male-to-male jumper wire from one Pin of the Push Button as a negative to power GND (Ground) on the Arduino UNO.

Push Button 2.3

Step 4: Connect the Blue male-to-male jumper wire from the other Pin of the push button (not connected to GND) to any digital pin on the Arduino UNO. In this tutorial, we will use digital pin 13.

Push Button 2.4

Step 5: Connect Black male-to-male jumper wire from the shorter pin of the first LED as a negative to power GND (Ground) on the Arduino UNO.

Push Button 2.5

Step 6: Connect Red male-to-male jumper wire from the longer pin of the first LED as a positive to digital pin 9 on the Arduino UNO.

Push Button 2.6

Step 7: Connect White male-to-male jumper wire from the shorter pin of the second LED as a negative to power GND (Ground) on the Arduino UNO.

Push Button 2.7

Step 8: Connect Green male-to-male jumper wire from the longer pin of the second LED as a positive to digital pin 7 on the Arduino UNO.

Push Button 286

Make sure to connect the Arduino USB blue cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Type int ledPin1 = 9; as shown in the picture below.

Push Button Type1.

Step 3: Type const int LedPin2 = 7; as shown in the picture below.

Push Button Type2.

Step 4: Type int buttonPin = 13; as shown in the picture below.

Push Button Type3.

Step 5: Type int buttonState = 0; as shown in the picture below.

Push Button Type4.

Step 6: Inside the (void setup()) function, type pinMode (ledPin1, OUTPUT); as shown in the picture below.

Push Button Type5.

NB: pinMode will help the Arduino board to decide which port should be activated.

Step 7: Inside the (void setup()) Type pinMode (ledPin2, OUTPUT); as shown in the picture below.

Push Button Type6.

Step 8: Type pinMode (buttonPin, INPUT_PULLUP); as shown in the picture below.

Push Button Type7.

Step 9: Scroll down and click inside the void loop() function and Type buttonState = digitalRead (buttonPin); as shown in the picture below.

Push Button Type8.

Step 10: Type this conditional statement if (buttonState == LOW) { digitalWrite (LedPin1, HIGH); digitalWrite (ledPin2, HIGH); } as shown in the picture below.

Push Button Type9.

Step 11: Type else { digitalWrite (LedPin1, LOW); digitalWrite (ledPin2, LOW); } as shown in the picture below.

Push Button Type10.

CONCLUSION

To sum up, the one LED blink project demonstrates a foundational concept in electronics and programming. Through this simple yet illuminating endeavor, learners grasp the essentials of hardware interfacing, coding logic, and timing control. This project lays the groundwork for more advanced explorations while showcasing the transformative power of just a single LED, sparking curiosity and creativity in the world of DIY electronics.