Pages: [1]   Go Down
Author Topic: 2x2x2 cube qeustion  (Read 536 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
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
//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);
  digitalWrite(C2, HIGH);
  digitalWrite(C3, HIGH);
  digitalWrite(C4, HIGH);
  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
Melbourne, Australia
Online Online
Brattain Member
Karma: 511
Posts: 19323
Lua rocks!
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.

Please post technical questions on the forum - not to me by personal message. Thanks a lot.

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
Karma: 549
Posts: 27419
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
 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 56 times.)

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

Pages: [1]   Go Up
Jump to: