Go Down

Topic: led cube 3x3 guide pls (Read 642 times)previous topic - next topic

dinky

Oct 26, 2011, 03:57 pm
i would like to ask if this simple code is correct,  any correction will be much appreciated. many thanks!
here it goes, i connected all the 9 cathodes together and repeated the process 3times just like the ones shown in youtube;
all 27 anodes connected together forming 9 pins , 3 levels, right?

int pinarray[9] = {1,2,3,4,5,6,7,8,9); //pins 1-9 on the arduino are each connnected
// to the 9 anodes
int pin10 = 10; // pin 10 on the arduino is connected to cathode first level
int pin10 = 11; // pin 11 on the arduino is connected to cathode 2nd level
int pin10 = 12; // pin 11 on the arduino is connected cathode 3rd level
int x;

void setup(){

pinMode = (pinarray[9] , OUTPUT);{

pinMode = (10 , OUTPUT);
pinMode = (11 , OUTPUT);
pinMode = (12, OUTPUT);

}

void loop(){

for(x= pinarray[9]; x<10; x++);{
digitalWrite( pinarray[9], HIGH);
digitalWrite(10,HIGH);
delay(100);}

for(x= pinarray[9]; x<10; x++);{
digitalWrite( pinarray[9], HIGH);
digitalWrite(11,HIGH);
delay(100);}

for(x= pinarray[9]; x<10; x++);{
digitalWrite( pinarray[9], HIGH);
digitalWrite(12,HIGH);
delay(100);}

digitalWrite( pinarray[9], LOW);
digitalWrite(12,LOW);
delay(100);

digitalWrite( pinarray[9], LOW);
digitalWrite(11,LOW);
delay(100);

digitalWrite( pinarray[9],LOW);
digitalWrite(10,LOW);
delay(100);

}

is this the right code to light all pins simultaneously from level 1 to level 3
and eventually turning it off? tnx

PaulS

#1
Oct 26, 2011, 04:15 pm
Quote
i would like to ask if this simple code is correct

No, it isn't. When you have something that will at least compile, come on back.

If the problem is that you don't understand a compiler message, show us the message and the code.

Go Up

Please enter a valid email to subscribe