my arduino based LED cube 3X3X3
My LED cube - 3X3X3.. arduino based.
Hello people..
I'm Saksham Prakash from Lucknow, India. Recently I made a really simple LED cube which can display numbers, alphabets, patterns and designs etc.
The Arduino Micreocontroller |
The Cube 3X3X3 |
Random LED Program |
Program :
int i;
int a;
void setup () {
for
(i=4; i<14; i++){
pinMode(i,
OUTPUT);
}
Serial.begin(9600);
}
void loop(){
digitalWrite
(13, HIGH);
digitalWrite
(2, HIGH);
digitalWrite
(3, HIGH);
for
(i=4;i<=12;i++){
digitalWrite(i,HIGH);
delay(100);
}
for
(i=12;i>=4;i--){
digitalWrite(i,LOW);
delay(100);
}
for
(i=12;i>=4;i--){
digitalWrite(i,HIGH);
delay(100);
}
for
(i=4;i<=12;i++){
digitalWrite(i,LOW);
delay(100);
}
for
(i=0;i<3;i++){
digitalWrite(12,HIGH);
digitalWrite(4,HIGH);
delay(150);
digitalWrite(4,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(5,HIGH);
delay(150);
digitalWrite(11,LOW);
digitalWrite(5,LOW);
digitalWrite(10,HIGH);
digitalWrite(6,HIGH);
delay(150);
digitalWrite(10,LOW);
digitalWrite(6,LOW);
digitalWrite(9,HIGH);
digitalWrite(7,HIGH);
delay(150);
digitalWrite(9,LOW);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
delay(150);
digitalWrite(8,LOW);
digitalWrite(7,HIGH);
digitalWrite(9,HIGH);
delay(150);
digitalWrite(9,LOW);
digitalWrite(7,LOW);
digitalWrite(6,HIGH);
digitalWrite(10,HIGH);
delay(150);
digitalWrite(6,LOW);
digitalWrite(10,LOW);
digitalWrite(5,HIGH);
digitalWrite(11,HIGH);
delay(150);
digitalWrite(11,LOW);
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
digitalWrite(12,HIGH);
delay(150);
digitalWrite(4,LOW);
digitalWrite(12,LOW);
digitalWrite(7,HIGH);
digitalWrite(9,HIGH);
delay(150);
digitalWrite(7,LOW);
digitalWrite(9,LOW);
digitalWrite(8,HIGH);
delay(150);
digitalWrite(9,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
delay(150);
digitalWrite(9,LOW);
digitalWrite(7,LOW);
}
digitalWrite
(2, HIGH);
digitalWrite
(3, HIGH);
for
(i=4;i<=12;i++){
digitalWrite(i,HIGH);
digitalWrite(i-1,LOW);
delay(150);
}
digitalWrite
(2, HIGH);
digitalWrite
(3, HIGH);
for
(i=4;i<=12;i++){
digitalWrite(i,HIGH);
}
delay(500);
digitalWrite
(2, HIGH);
digitalWrite
(3, HIGH);
for
(i=4;i<=12;i++){
digitalWrite(i,LOW);
}
delay(500);
digitalWrite
(2, HIGH);
digitalWrite
(3, HIGH);
a=100;
while
(a!=88){
if
(a==4){
while (a<=100){
Serial.println(a);
digitalWrite(9,0);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
digitalWrite(4,HIGH);
digitalWrite(12,1);
delay(a);
Serial.println(a);
digitalWrite(12,0);
digitalWrite(11,1);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(a);
Serial.println(a);
digitalWrite(11,0);
digitalWrite(10,1);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
delay(a);
Serial.println(a);
digitalWrite(10,0);
digitalWrite(7,1);
digitalWrite(6,LOW);
digitalWrite(9,HIGH);
delay(a);
Serial.println(a);
digitalWrite(7,0);
digitalWrite(4,1);
digitalWrite(9,LOW);
digitalWrite(12,HIGH);
delay(a);
Serial.println(a);
digitalWrite(4,0);
digitalWrite(5,1);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
delay(a);
Serial.println(a);
digitalWrite(11,LOW);
digitalWrite(5,0);
digitalWrite(6,1);
digitalWrite(10,HIGH);
delay(a);
a=a+2;
Serial.println(a);
digitalWrite(6,0);
digitalWrite(9,1);
digitalWrite(10,LOW);
digitalWrite(7,HIGH);
delay(a);
Serial.println(a);
a=a+2;
}
}
Serial.println(a);
digitalWrite(9,0);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
digitalWrite(4,HIGH);
digitalWrite(12,1);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(12,0);
digitalWrite(11,1);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(11,0);
digitalWrite(10,1);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(10,0);
digitalWrite(7,1);
digitalWrite(6,LOW);
digitalWrite(9,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(7,0);
digitalWrite(4,1);
digitalWrite(9,LOW);
digitalWrite(12,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(4,0);
digitalWrite(5,1);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(11,LOW);
digitalWrite(5,0);
digitalWrite(6,1);
digitalWrite(10,HIGH);
delay(a);
a=a-2;
Serial.println(a);
digitalWrite(6,0);
digitalWrite(9,1);
digitalWrite(10,LOW);
digitalWrite(7,HIGH);
delay(a);
Serial.println(a);
a=a-2;
}
digitalWrite(8,0);
digitalWrite(7,0);
digitalWrite(9,0);
delay(1000);
digitalWrite(10,1);
delay(250);
digitalWrite(11,1);
delay(250);
digitalWrite(12,1);
delay(250);
digitalWrite(7,1);
delay(250);
digitalWrite(4,1);
delay(250);
digitalWrite(8,1);
delay(250);
digitalWrite(9,1);
delay(250);
digitalWrite(6,1);
delay(2000);
digitalWrite(10,0);
digitalWrite(11,0);
digitalWrite(12,0);
digitalWrite(7,0);
digitalWrite(4,0);
digitalWrite(8,0);
digitalWrite(9,0);
digitalWrite(6,0);
delay(500);
digitalWrite(12,1);
delay(250);
digitalWrite(11,1);
delay(250);
digitalWrite(10,1);
delay(250);
digitalWrite(8,1);
delay(250);
digitalWrite(6,1);
delay(250);
digitalWrite(5,1);
delay(250);
digitalWrite(4,1);
delay(2000);
digitalWrite(10,0);
digitalWrite(11,0);
digitalWrite(12,0);
digitalWrite(4,0);
digitalWrite(8,0);
digitalWrite(5,0);
digitalWrite(6,0);
delay(500);
digitalWrite(10,1);
delay(250);
digitalWrite(11,1);
delay(250);
digitalWrite(12,1);
delay(250);
digitalWrite(7,1);
delay(250);
digitalWrite(5,1);
delay(250);
digitalWrite(9,1);
delay(2000);
digitalWrite(10,0);
digitalWrite(11,0);
digitalWrite(12,0);
digitalWrite(7,0);
digitalWrite(9,0);
digitalWrite(5,0);
delay(60000);
}
Random LED program:
int i=4;
void setup() {
while
(i<=12){
pinMode(i,OUTPUT);
i++;
}
pinMode
(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(13,OUTPUT);
Serial.begin(9600);
}
void loop() {
int
randomno = random(4,13);
int
randomlevel = random(1,4);
if
(randomlevel!=2 && randomlevel!=3){
digitalWrite(13,1);
digitalWrite(2,0);
digitalWrite(3,0);
}
digitalWrite(randomlevel,1);
digitalWrite(randomno,1);
delay(15);
digitalWrite(randomlevel,0);
digitalWrite(randomno,0);
}
Rate, Comment, Subscribe.. Thanks for watching.
Rate, Comment, Subscribe.. Thanks for watching.
Hi, nice work. how did u make the led cube. please send details on email@onlinesandeep.in
ReplyDelete