Go Down

Topic: 2x2x2 cube qeustion (Read 811 times) previous topic - next topic


Nov 24, 2012, 04:14 pm Last Edit: Nov 24, 2012, 04:50 pm by Tomtin Reason: 1
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

Nick Gammon

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 by personal message. Thanks!

More info:


"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
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131