Introduction: How to Control 8 Leds Using Arduino Uno

Picture of How to Control 8 Leds Using Arduino Uno

hey guys this is my first arduino project  plz  comment how u feel.       

Step 1: Things U Need

Picture of Things U Need

As this is easy project for beginner's so parts are also simple 
Parts:
1- Arduino uno or any other board will work
1-Beardboard
9- jumper wires or wires will also do 
8 -leds any color u like i used 3 red, 3 green and 2 blue
8- 1k resistors

Step 2: Placing the Leds and Wiring

Picture of Placing the Leds and Wiring

In this step u have to place the leds on the bread board i have kept the positive  wire on the right side . 
Next wire them as shown in 

Step 3: Uploading the Code

Picture of Uploading the Code

int ledPins[] = {2,3,4,5,6,7,8,9};
int delayTime = 100; void setup() { for(int i = 0; i < 8; i++) pinMode(ledPins[i],OUTPUT);

}

void loop() { digitalWrite(ledPins[0], HIGH);

delay(delayTime);

digitalWrite(ledPins[1], HIGH);

delay(delayTime);

digitalWrite(ledPins[2], HIGH);

delay(delayTime);

digitalWrite(ledPins[3], HIGH);

delay(delayTime);

digitalWrite(ledPins[4], HIGH);

delay(delayTime);

digitalWrite(ledPins[5], HIGH);

delay(delayTime);

digitalWrite(ledPins[6], HIGH);

delay(delayTime);

digitalWrite(ledPins[7], HIGH);

delay(delayTime);

//Turns Each LED Off

digitalWrite(ledPins[7], LOW);

delay(delayTime);

digitalWrite(ledPins[6], LOW);

delay(delayTime);

digitalWrite(ledPins[5], LOW);

delay(delayTime);

digitalWrite(ledPins[4], LOW);

delay(delayTime);

digitalWrite(ledPins[3], LOW);

delay(delayTime);

digitalWrite(ledPins[2], LOW);

delay(delayTime);

digitalWrite(ledPins[1], LOW);

delay(delayTime);

digitalWrite(ledPins[0], LOW);

delay(delayTime);

}

Comments

rvenegas1 (author)2014-10-30

If you are going to put something out for people to try, then your instructions need to be more specific. The pictures are blurry and you don't really explain how to connect the LEDs, resistors, and wires. The code is also giving me 5 errors, I tried the code that maewert put out for the binary name and his worked. Not trying to put you down, but the steps aren't that great to follow.

akki5230 (author)2013-09-05

And how to control more than 11 LEDs on arduino?

mathesen1097 (author)2013-05-19

This is pretty awesome, I was going to use the code you inserted to make a project. It is a little led dome that changes color. I am using my ardunio for the first time. I'll post it soon with my fingers crossed that it works.

I am very happy that my projects are helping people,send me your project's photos when it is done

Clyde2013 (author)2013-04-12

How would you make them spell a name in Binary code?

maewert (author)Clyde20132013-04-12

Try this:

/*
  SpellMyName
  Turns on 8 LEDs to spell my name in Binary
*/

// Pins 2-9 have my 8 LEDs connected to spell my name
int led[8] = {2,3,4,5,6,7,8,9};

// MyNameLength holds the length of my name in characters
#define MyNameLength 4
char name[MyNameLength]= {'M','a','r','k'};

// the setup routine runs once when you press reset:
void setup()
{               
  // initialize the digital pin as an output.
  int i;
  for (i=0;i<8;i++)
  {
    pinMode(led[i], OUTPUT);    
  }
}

/*
  LightUp routine lights up the 8 LEDs to spell out in binary the letter passed in
*/
void LightUp(char letter)
{
  int i;
  for (i=0;i<8;i++)
  {
    // lets check the bit to see if it is on or off
    if ((letter&(1<<i))!=0)
    {
      digitalWrite(led[i],HIGH);
    }
    else
    {
      digitalWrite(led[i],LOW);
    }
  }
}

// the loop routine runs over and over again forever:
void loop()
{
  int i;
 
  for (i=0;i<MyNameLength;i++)
  {
    LightUp(name[i]);
    delay(1000);               // wait for a second
  }
}

Pranavthegreat (author)2013-04-12

i hav never tried to spell a name and also you will need a led matrix

About This Instructable

34,368views

15favorites

License:

Bio: I was 13 when I made this account so please don't make fun of my username
More by Pranavthegreat:How To Make A Dark SensorHow to program attiny using arduino unocontrol your servo using a 555 timer!!!!!!!!!!!!!!!!!!!!!!!!!!
Add instructable to: