Introduction: 5x2 LED Matrix With Arduino

To make this 5x2 LED Matrix you need the following:

12x    Jumper Wires
10x    LEDs
10x    330 Ohm Resistors
1x      Breadboard or Perfboard
1x      Arduino Uno or Arduino Mega 2560

This is a very easy and quick project. It takes about 30 minutes to do.

This is the code that I used:

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int led5 = 6;
int led6 = 7;
int led7 = 8;
int led8 = 9;
int led9 = 10;
int led10 = 11;
int brightness = 0; 
int fadeAmount = 5;


// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an output.pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(led10, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led1, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(75);               // wait for a second
digitalWrite(led1, LOW);
delay(75);// turn the LED off by making the voltage LOWdelay(100);
digitalWrite(led10, HIGH);
delay (75);
digitalWrite(led10, LOW);
delay(75);
digitalWrite(led1, HIGH);
delay (75);
digitalWrite(led1, LOW);
delay(75);
digitalWrite(led2, HIGH);
delay (75);
digitalWrite(led2, LOW);
delay(75);
digitalWrite(led3, HIGH);
delay (75);
digitalWrite(led3, LOW);
delay(75);
digitalWrite(led6, HIGH);
delay (75);
digitalWrite(led6, LOW);
delay(75);
digitalWrite(led9, HIGH);
delay (75);
digitalWrite(led9, LOW);
delay(75);
digitalWrite(led8, HIGH);
delay (75);
digitalWrite(led8, LOW);
delay(75);
digitalWrite(led10, HIGH);
delay (75);
digitalWrite(led10, LOW);
delay(75);
digitalWrite(led7, HIGH);
delay (75);
digitalWrite(led7, LOW);
delay(75);
digitalWrite(led1, HIGH);
delay (75);
digitalWrite(led1, LOW);
delay(75);
digitalWrite(led5, HIGH);
delay (75);
digitalWrite(led5, LOW);
delay(75);
digitalWrite(led2, HIGH);
delay (75);
digitalWrite(led2, LOW);
delay(75);
digitalWrite(led9, HIGH);
delay (75);
digitalWrite(led9, LOW);
delay(75);
digitalWrite(led7, HIGH);
delay (75);
digitalWrite(led7, LOW);
delay(75);
digitalWrite(led6, HIGH);
delay (75);
digitalWrite(led6, LOW);
delay(75);
digitalWrite(led3, HIGH);
delay (75);
digitalWrite(led3, LOW);
delay(100);
digitalWrite(led8, HIGH);
delay (75);
digitalWrite(led8, LOW);
delay(75);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led7, HIGH);
digitalWrite(led8, HIGH);
digitalWrite(led9, HIGH);
digitalWrite(led10, HIGH);
delay(150);

analogWrite(led1, brightness);
analogWrite(led2, brightness);
analogWrite(led3, brightness);
analogWrite(led4, brightness);
analogWrite(led5, brightness);
analogWrite(led6, brightness);
analogWrite(led7, brightness);
analogWrite(led8, brightness);
analogWrite(led9, brightness);
analogWrite(led10, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }   
  // wait for 30 milliseconds to see the dimming effect  
  delay(30);                          
}

Comments

About This Instructable

1,221views

8favorites

License:

More by JSTArollin:T-Shirt Wall ArtSteal the Bacon Game with Arduino6 LED Pendulum with Arduino
Add instructable to: