Go Down

Topic: Using i/o via an array (Read 282 times) previous topic - next topic

fiddler

I'm trying to get my head around arrays in C.

I can do the following as to assign i/o pins via an array
int pins [6] = { 3, 5, 7, 10, 12, 13 }

However, can I assign a name to a pin and then use it in the array

const int Button1 = 3;
int pins [6] = { Button1, 5, 7, 10, 12, 13 }

thanks for any clarification

K

PaulS

Quote
However, can I assign a name to a pin and then use it in the array

What did the compiler tell you?

If you didn't ask, why not?

If you had, it would have said something along the lines of "Success".

fiddler

Ha

I was so busy thinking about it, before buggering of to work, that I missed the obvious.

Cheers

Go Up