Go Down

Topic: Using i/o via an array (Read 304 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
 


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!

Arduino
via Egeo 16
Torino, 10131
Italy