Help with setup arduino

I like to do this. With a 3x3x3 led cube.

Led kathodes (layers) Pin 11 12 13 need to be called A B C I can make a case for it.

Led anode 1 to 9 on pin 1 to 9 of the arduino

But in the loop ik want to do something like this.

void loop() {
//when i do this//

Light(A10101010) ;

//Arduino does this//

    //A//digitalWrite(11, LOW);
   // firts int//     digitalWrite(11,LOW);
   // second//     digitalWrite(1, HIGH);
   //third      //     digitalWrite(2, LOW);
   //fourth   //     digitalWrite(3,HIGH);
    And so on. 

So A=11 B=12 C=13. Alway Go LOW
And kolom 1-9 follows the integers after A B or C.

Please help me

After compiling, variable names do not exist. So, naming a pin A, and then expecting the Arduino to know what pin that is at run time is not realistic. You have to maintain some kind of relationship between the name and the corresponding pin number, so that when your code sees 'A', it knows what pin number to use.

I do not know how you expect to declare the Light() function. In particular, the type of the argument can only be guessed at. I'm guessing that you are expecting to pass a string, "A10101010" to the function. If that is the case, where is the string coming from?

By the way, I HATE guessing games.

What PaulS wrote.

Also: I do not know what kind of Arduino you have but it is usually a good idea to avoid pin 1 (and pin 0). Pins 0 and 1 are used for serial access. Using them for something else will make debugging really difficult.

I wil use a uno. With 6 ic's. So the digitalWrite will be replaced by shift.writeBit for shifty.h libary.

//I made a function. 

void Layer(int) 
 //With a 6 case. 
//1 layer LOW.= other 5 HIGH. 
//So only one Layer can be LOWat the //same time(cathodes) 

//For the anodes i made a function. 
void Led(int A, int state) 

shift.writeBit(A %36, state) ;
Layer((A +35/36));

//So all the leds go with layer included. 
//Tested and working. 

//I made a function. 

void Light(int A, int state1, int state2, int state3, int state4, int state 5, int state6) {

Led(A, state1) ;
Led(A +1, state2) ;
Led(A +2, state3) ;
Led(A +3, state4) ;
Led(A +4, state5) ;
Led(A +5, state6) ;

//so now i can do for led 7 to 12 in  one line. 


//But a 1 for the led is confusing with the //states next to it. 
//So i want to change 1 for A. 
// 7 for B. 
// 13 for C. 
//untill 30 For F. 
and if possible in some way i like to have the , , , , , , gone. But don't know how.

Jeroentje2212 wrote:

//So i want to change 1 for A. // 7 for B. // 13 for C. //untill 30 For F.

This doesn't quite make sense. You seem to be adding six each time, so you do not end at 30 !

How about:

const byte A =  1 ;
const byte B =  7 ;
const byte C = 13 ;
const byte D = 19 ;
const byte E = 25 ;
const byte F = 31 ;

This answers your question literally but ignores the problem that you are (for some reason) really trying to "solve".

Light(7,1,1,0,0,1,1); : : : and if possible in some way i like to have the , , , , , , gone. But don't know how.

Perhaps you want Light("A110011") ; You will have to change the definition of the function Light(...) to something like

void Light(const char * inString)

and 'inString' will be an array of length 8, where inString[0] is the character 'A', and inString[1] and inString[2] and inString[5] and inString[6] are the character '1', and inString[3] and inString[4] are the character '0'. The Light function will have to act appropriately for such inputs.

The array 'inString' is of length 8 because the 7 characters are followed by a binary 0 (null character) to mark the end of the c string.

You may want the Light(...) function to check that strlen(inString) == 8 .

By the way,

6 * (inString[0] - 'A') + 1

will give you the number that corresponds to A, B, C, D, E, and F (but not 30 !).

This code is untested and may contain errors. I would not be surprised if it draws many comments.