• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

Circuits for Beginners | Basic Circuits | LED Driver | Hobby Circuits | Transistor Circuits

New-Projects | Privacy Policy | About us | Contact | Disclaimer | Copyright | Videos

You are here: Home / DIY LED Projects / Blinking 3 LEDs (R,G,B) Sequentially Using Arduino Circuit

Blinking 3 LEDs (R,G,B) Sequentially Using Arduino Circuit

Last Updated on June 23, 2019 by Swagatam 4 Comments

ask questions through comments

The post explains how to run or blink three LEDs in sequence using Arduino. The post was written and submitted by: Jack Franko

PROGRAM
/* make RGB LEDs to blink in series one by one at interval
of 1000MS */

int R = 12;int G = 11;int B = 10;
void setup(){  pinMode
(R,OUTPUT);  pinMode
(G,OUTPUT);  pinMode
(B,OUTPUT);

}
void loop(){  digitalWrite
(R,HIGH);  delay (1000);  digitalWrite
(R,LOW);  delay (1000);  digitalWrite
(G,HIGH);  delay (1000);  digitalWrite
(G,LOW);  delay (1000);  digitalWrite
(B,HIGH);  delay (1000);  digitalWrite
(B,LOW);  delay (1000);

}

DESCRIPTION

Today, We are  going
to learn to turn on and off  3 LEDs (RED, GREEN, BLUE) one by one at the interval of
1000MS that is one second.
int R = 12;int G = 11;int B = 10;

as we are aware of integer statement we had learned before ,
today we will use integer R,G & B which will be set  on arduino pin no 12, 11 and 10 respectively.
We are using R,G and B for led colors  to set on and off it confidentially to make less complicated and easy to understand what we are doing.
After setting all integers as shown in program above, we will set the main program part which is void setup stated as below

void setup(){  pinMode
(R,OUTPUT);  pinMode
(G,OUTPUT);  pinMode
(B,OUTPUT);

here we are stating the pine mode as output with previously set integer ie. R for pin no 12, G for pin no 11 & B for pin no 10.  After stating arduino pin with pinmode  as output with integer tis time to set our loop for all pins to work with. Here 2nd main function is void loop as stated below.

void loop(){  digitalWrite
(R,HIGH);  delay (1000);  digitalWrite
(R,LOW);  delay (1000);  digitalWrite
(G,HIGH);  delay (1000);  digitalWrite
(G,LOW);  delay (1000);  digitalWrite
(B,HIGH);  delay (1000);  digitalWrite
(B,LOW);  delay (1000);

} Here in statement of loop we are telling arduino to work with pin no 12 which is stated as R in integer and output in void setup. We will tell arduino to set pin no 12 at position “high” which means “ON” and wait for one second which 1000MS in arithmetical language with the help of function “delay” . script stated below will set led to on position and it will wait for 1 second but Arduino will not understand that what to do after waiting for 1 second, this will leads to stay led in on position for long.

  digitalWrite
(R,HIGH);  delay (1000);

so after  one second we must tell arduino to set pin no” 12” ie” R” to position” low”  which is “OFF”.

  digitalWrite
(R,LOW);

the statement stated above will set the led off . If we dint comment to wait for 1 second Arduino will continue to read the loop and turn the LED  to “ON” position frequently .so at this stage we have to comment and state the delay function to tell Arduino that after pin no 12 in “ OFF” wait for 1 second which 1000MS.

  delay (1000);

this is a complete loop for pin no 12 which we had stated for RED LED. This will result to put ON the led and wait for 1 second and OFF the LED and wait for 1 Second. After this we have to set the same loop for GREEN and BLUE LED which is as follows.

  digitalWrite
(G,HIGH);  delay (1000);  digitalWrite
(G,LOW);  delay (1000);  digitalWrite
(B,HIGH);  delay (1000);  digitalWrite
(B,LOW);  delay (1000);

this program will set three LEDs R, G & B to turn “ON” and “OFF” respectively for long time. Her you can program more then 3 LEDs also to turn on and off as you wish. This tutorials are for Newbees to understand the program and to play with Arduino.

get free help for circuit diagrams

You'll also like:

  • 1.  Blinking an LED with Arduino – Complete Tutorial
  • 2.  Simple RGB LED Controller Circuit
  • 3.  How to Drive High Watt LEDs with Arduino
  • 4.  How to Build a Grow Light Circuit
  • 5.  Illuminating 100 LEDs from 6 Volt Battery
  • 6.  Sunrise Sunset Simulator LED Circuit

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

Subscribe for the Latest Posts


 

Reader Interactions

Comments

    Have Questions? Please post your comments below for quick replies! Comments should be related to the above artcile Cancel reply

    Your email address will not be published. Required fields are marked *

  1. Sammy Schutz says

    September 6, 2019 at 12:03 am

    Hi Swagatam,
    I am in need of some help.
    How would you build a circuit to have 3 three LEDs blink in sequence? Could you describe what the actual circuit layout would look like? I am using the NI Elvis Platform.
    Thank you,
    Sammy

    Reply
    • Swagatam says

      September 6, 2019 at 9:27 am

      Hi Sammy,

      By “blinking” do you mean the LEDs should “chase” or “run” in sequence?

      Reply
      • Sammy Schutz says

        September 6, 2019 at 4:52 pm

        I mean that as soon as one turns on it turns off and then the next light turns on and then off and so on. I’m not sure what the proper terminology for that is.

        Reply
        • Swagatam says

          September 7, 2019 at 1:40 pm

          OK you can try the first circuit from this post, with one modification.

          Disconnect IC 4017 IC pin15 from ground and connect it with its pin7

          https://www.homemade-circuits.com/knight-rider-led-chaser-circuit-mains/

          Reply

Primary Sidebar



Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (98)
  • 741 IC Circuits (19)
  • Amplifiers (59)
  • Arduino Engineering Projects (83)
  • Audio Projects (94)
  • Battery Chargers (83)
  • Car and Motorcycle (94)
  • Datasheets (46)
  • Decorative Lighting (Diwali, Christmas) (32)
  • DIY LED Projects (89)
  • Electronic Components (97)
  • Electronic Devices and Circuit Theory (35)
  • Electronics Tutorial (109)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (12)
  • GSM Projects (9)
  • Health Related (19)
  • Heater Controllers (28)
  • Home Electrical Circuits (100)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (64)
  • Mini Projects (156)
  • Motor Controller (66)
  • MPPT (7)
  • Oscillator Circuits (24)
  • PIR (Passive Infrared) (8)
  • Power Electronics (33)
  • Power Supply Circuits (74)
  • Radio Circuits (9)
  • Remote Control (47)
  • Security and Alarm (61)
  • Sensors and Detectors (118)
  • SG3525 IC (5)
  • Simple Circuits (74)
  • SMPS (29)
  • Solar Controllers (60)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (40)
  • Ultrasonic Projects (14)
  • Water Level Controller (45)


Circuit Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator


You can also Chat with me here:

Facebook
Twitter
YouTube
Instagram
My Facebook-Page
Quora



© 2022 · Swagatam Innovations

We use cookies on our website to give you the best experience.
Cookie settingsAccept All
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Please visit the Privacy Policy Page for more info.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT