Pages: [1]   Go Down
Author Topic: 2x2x2 cube qeustion  (Read 438 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I am new to arduino and as a first try i made a led ube 2x2x2.
I connected the annodes to I/O 13,12,11,10 and the 2 kathodes to 4 and 5.

If i run a simple program and try to light all the leds only one layer will go on.
Why wont both layers go on?

I used no resistors.

My code below

//2x2x2 LED Cube Sequence 1
//By: TT
//23-11-2012
//all lights on/off
int C1 = 13;
int C2 = 12;
int C3 = 11;
int C4 = 10;

int L1 = 3;
int L2 = 4;


void setup() {
  pinMode(C1, OUTPUT);
  pinMode(C2, OUTPUT);
  pinMode(C3, OUTPUT);
  pinMode(C4, OUTPUT);

  pinMode(L1, OUTPUT);
  pinMode(L2, OUTPUT);

}

void loop() {
  digitalWrite(L1, HIGH); //Layer 1 on
  digitalWrite(L2, HIGH); //Layer 2 on
  digitalWrite(C1, HIGH);
  delay(50);
  digitalWrite(C2, HIGH);
  delay(50);
  digitalWrite(C3, HIGH);
  delay(50);
  digitalWrite(C4, HIGH);
  delay(500);
  digitalWrite(C4, LOW);
  digitalWrite(L1, LOW); //Layer 1 Ends
  digitalWrite(C1, LOW);
  digitalWrite(C2, LOW);
  digitalWrite(C3, LOW);
  digitalWrite(L2, LOW); //Layer 2 Ends
 
}
« Last Edit: November 24, 2012, 10:50:02 am by Tomtin » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 444
Posts: 23859
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"I used no resistors."

Because you want to damage all your IO pins right off the bat?

Your ordering is a little off
void loop(){
write Anode(s)  HIGH
write cathode1 LOW, pause, write cathode1 HIGH

write Anode(s) HIGH
write cathode2 LOW, pause, write cathode2 HGH
}


* 2x2x2cube.jpg (54.29 KB, 960x720 - viewed 40 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: