2x2 led matrix
SOME CONNECTING WIRES
Step 1: Connect 4 led in parallel connection
Step 2: Connect 4 resister in the anode
Step 3: Upload program given below to Arduino
Step 4: Connect the pins to resister mentioned in the program
Step 5: Make power supply to Arduino board.
Apparatus required:
1X ARDUINO UNO
4x LED
1X BREADBOARD
4X 200 OHMS RESISTER
SOME CONNECTING WIRES
CONSTRUCTION:
Step 1: Connect 4 led in parallel connection
Step 2: Connect 4 resister in the anode
Step 3: Upload program given below to Arduino
Step 4: Connect the pins to resister mentioned in the program
Step 5: Make power supply to Arduino board.
Program:
int f = 8; //Connect "f" terminal of LED Cube to 8th pin of arduino
int e = 9; //Connect "e" terminal of LED Cube to 9th pin of arduino int d = 10; //Connect "d" terminal of LED Cube to 10th pin of arduino int c = 11; //Connect "c" terminal of LED Cube to 11th pin of arduino int b = 12; //Connect "b" terminal of LED Cube to 12th pin of arduino int a = 13; //Connect "a" terminal of LED Cube to 13th pin of arduino
int i=0, j=0, upper_limit=15, delay_time=100;
// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(f, OUTPUT); pinMode(e, OUTPUT); pinMode(d, OUTPUT); pinMode(c, OUTPUT); pinMode(b, OUTPUT); pinMode(a, OUTPUT); }
void loop() { for(j=0;j<delay_time;j++) { for(i=0;i<upper_limit;i++) { //turn on LED 3 digitalWrite(f, HIGH); digitalWrite(e, LOW); digitalWrite(d, LOW); digitalWrite(c, HIGH); digitalWrite(b, HIGH); digitalWrite(a, HIGH); //turn on LED 4 digitalWrite(f, HIGH); digitalWrite(e, LOW); digitalWrite(d, HIGH); digitalWrite(c, LOW); digitalWrite(b, HIGH); digitalWrite(a, HIGH); } //Turn off LED 3 and LED 4 digitalWrite(f, LOW); digitalWrite(e, LOW); for(i=0;i<upper_limit;i++) { //turn on LED 5 digitalWrite(f, LOW); digitalWrite(e, HIGH); digitalWrite(d, HIGH); digitalWrite(c, HIGH); digitalWrite(b, HIGH); digitalWrite(a, LOW); //turn on LED 6 digitalWrite(f, LOW); digitalWrite(e, HIGH); digitalWrite(d, HIGH); digitalWrite(c, HIGH); digitalWrite(b, LOW); digitalWrite(a, HIGH); } //Turn off LED 5 and LED 6 digitalWrite(f, LOW); digitalWrite(e, LOW); } for(j=0;j<delay_time;j++) { for(i=0;i<upper_limit;i++) { //turn on LED 7 digitalWrite(f, LOW); digitalWrite(e, HIGH); digitalWrite(d, LOW); digitalWrite(c, HIGH); digitalWrite(b, HIGH); digitalWrite(a, HIGH); //turn on LED 8 digitalWrite(f, LOW); digitalWrite(e, HIGH); digitalWrite(d, HIGH); digitalWrite(c, LOW); digitalWrite(b, HIGH); digitalWrite(a, HIGH); } //turn off LED 7 and LED 8 digitalWrite(f, LOW); digitalWrite(e, LOW); for(i=0;i<upper_limit;i++) { //turn on LED 1 digitalWrite(f, HIGH); digitalWrite(e, LOW); digitalWrite(d, HIGH); digitalWrite(c, HIGH); digitalWrite(b, HIGH); digitalWrite(a, LOW); //turn on LED 2 digitalWrite(f, HIGH); digitalWrite(e, LOW); digitalWrite(d, HIGH); digitalWrite(c, HIGH); digitalWrite(b, LOW); digitalWrite(a, HIGH); } //turn off LED 1 and LED 2 digitalWrite(f, LOW); digitalWrite(e, LOW); } }
For details follow us and ask in Contact Form. You will receive response in 24 hours
0 comments:
Post a Comment