[edit]Hi,
ok I've just changed my question.
Can I do this?:
int myRows[] = {0, 1, 2, 3, 4, 5, 6, 7};
int myPower[] = {A0, A1, A2, A3, A4, A5, A6, A7};
int brightness = 255;
int Delay = 50;
void setup(){
pinMode(myPower[0, 1, 2, 3, 4, 5, 6, 7], OUTPUT);
}
void loop(){
row1();
row2();
analogWrite(myPower[3, 4], brightness);
delay(Delay);
row3();
analogWrite(myPower[2, 5], brightness);
delay(Delay);
row4();
analogWrite(myPower[2, 3, 4, 5], brightness);
delay(Delay);
row5();
analogWrite(myPower[2, 5], brightness);
delay(Delay);
row6();
analogWrite(myPower[2, 5], brightness);
delay(Delay);
row7();
analogWrite(myPower[2, 5], brightness);
delay(Delay);
row8();
}
void row1()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[0], OUTPUT);
digitalWrite(myRows[0], LOW);
pinMode(myRows[1, 2, 3, 4, 5, 6, 7], INPUT);
}
void row2()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[1], OUTPUT);
digitalWrite(myRows[1], LOW);
pinMode(myRows[0, 2, 3, 4, 5, 6, 7], INPUT);
}
void row3()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[2], OUTPUT);
digitalWrite(myRows[2], LOW);
pinMode(myRows[0, 1, 3, 4, 5, 6, 7], INPUT);
}
void row4()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[3], OUTPUT);
digitalWrite(myRows[3], LOW);
pinMode(myRows[1, 2, 0, 4, 5, 6, 7], INPUT);
}
void row5()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[4], OUTPUT);
digitalWrite(myRows[4], LOW);
pinMode(myRows[0, 1, 2, 3, 5, 6, 7], INPUT);
}
void row6()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[5], OUTPUT);
digitalWrite(myRows[5], LOW);
pinMode(myRows[1, 2, 3, 4, 0, 6, 7], INPUT);
}
void row7()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[6], OUTPUT);
digitalWrite(myRows[6], LOW);
pinMode(myRows[0, 1, 2, 4, 5, 3, 7], INPUT);
}
void row8()
{
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
pinMode(myRows[7], OUTPUT);
digitalWrite(myRows[7], LOW);
pinMode(myRows[1, 2, 3, 4, 5, 6, 0], INPUT);
}
I'm experimenting with coding since I'm new with it.
I think I can't do this or similar things :
digitalWrite(myPower[0, 1, 2, 3, 4, 5, 6, 7], LOW);
But is there any other way of doing something similar?
Thanks!
[/edit]