Introduction: GETTING STARTED WITH ARDUINO #5

HI, Sorry for the delay of this tutorial. Here in this tutorial I will teach you how to Control two LED using Arduino. this is the basic principle of traffic light systems. Where light changes from one color to other color after a delay of few minutes. If you had missed my previous instructables check it out and follow me for Arduino tutorial and Python tutorial which I will start publishing from tonight. So it has been my habit of explaining the component I use in the ibles. Here i have used Arduino and LED. Hope all know what a LED is. Let me again recall you what an arduino is:-

Arduino uno :-
Arduino is a pocket size computer that is used to control to control the physical world which cannot be performed by your desktop.It takes input from your input device such as sensors,switches and many more accordingly it controls the output device such as motors....etc

The other application of Arduino is : -

-Programmable light displays that respond to music or human interaction

- Robots that use information from sensors to navigate or perform other tasks

- Unique, customizable controllers and interfaces for music, gaming, and more

- Connecting real world objects to the Internet (twitter is especially popular)

- Anything interactive

- Automating and prototyping

Let's get started.

Step 1: ELECTRONICS REQUIRED :-

The basic electronic required for building are :-

  • Arduino uno
  • Breadboard
  • Jumper wires
  • LED

Let's build electronics.

Step 2: BUILDING ELECTRONICS :-

  • Place two led on a breadboard (i have used red and blue) in such a way that the cathode leg of the led should be place in negative supply of the breadboard.
  • Then the cathode supply of the breadboard should be in inserted in the ground pin of the Arduino using jumper wires.
  • Later the annode pin of the led should be connected the digital pin (i have used 11 and 9 ).

So when you finished as per the instruction,you are ready with the hardware. Now it's coding time

Step 3: CODING:-

int leDelay=50; //DELAY BETWEEN EACH BLINKING OF SAME LED
int redpin=3; //DIGITAL PIN TO WHICH LED 

void setup() {   pinMode(redpin , OUTPUT); //INITIALIZING THE DIGITAL PIN 3 SHOULD BE OUTPUT

	pinMode(bluepin , INPUT);  //INITIALIZING THE DIGITAL PIN 2 SHOULD BE THE OUTPUT

}

void loop() {   digitalWrite(redpin , HIGH);   delay(leDelay);// SUPPLYING  VOLTAGE TO DIGITAL PIN FOR 50mS BECAUSE ledDelay = 50 AS PER FIRST STEP

digitalWrite(redpin , LOW);   delay(leDelay);// NO VOLTAGE TO DIGITAL PIN FOR 50mS

digitalWrite(redpin , HIGH);   delay(leDelay);//BECAUSESUPPLYING  VOLTAGE TO DIGITAL PIN FOR 50mS  ledDelay = 50 AS PER FIRST STEP

digitalWrite(redpin , LOW);   delay(leDelay);//NO VOLTAGE TO DIGITAL PIN FOR 50mS

delay(1000); //1 sec FOR CHANGING FROM COLOUR RED TO BLUE

digitalWrite(bluepin , HIGH );   delay(leDelay);//BECAUSESUPPLYING  VOLTAGE TO DIGITAL PIN FOR 50mS  ledDelay = 50 AS PER FIRST STEP

digitalWrite(bluepin , LOW);   delay(leDelay);//NO VOLTAGE TO DIGITAL PIN FOR 50mS

delay(1000);

}

Comments

author
OldByte made it! (author)2015-08-02

Can you change "pinMode(bluepin , INPUT);" by "pinMode(bluepin , OUTPUT);
:0)

author
appytechie made it! (author)appytechie2015-08-02

yes you can

About This Instructable

605views

19favorites

License:

More by appytechie:Program the Linkit One Using a Raspberry PILinkit One Controlled El-wireLinkit One - Dice
Add instructable to: