I have the following pin assignments, and I was wondering if there is an efficient way to do the pinMode assignments? c01-c24 and t01r-t24r are outputs, t01-t24 are inputs.
// control lines
int c01 = PIN_PE0; int c02 = PIN_PE1; int c03 = PIN_PE2; int c04 = PIN_PE3;
int c05 = PIN_PE4; int c06 = PIN_PE5; int c07 = PIN_PE6; int c08 = PIN_PE7;
int c09 = PIN_PH0; int c10 = PIN_PH1; int c11 = PIN_PH2; int c12 = PIN_PH3;
int c13 = PIN_PC4; int c14 = PIN_PC5; int c15 = PIN_PC6; int c16 = PIN_PC7;
int c17 = PIN_PJ0; int c18 = PIN_PJ1; int c19 = PIN_PJ2; int c20 = PIN_PJ3;
int c21 = PIN_PJ4; int c22 = PIN_PJ5; int c23 = PIN_PJ6; int c24 = PIN_PG2;
// green leds
int t01 = PIN_PF0; int t02 = PIN_PF1; int t03 = PIN_PF2; int t04 = PIN_PF3;
int t05 = PIN_PF4; int t06 = PIN_PH4; int t07 = PIN_PH5; int t08 = PIN_PH6;
int t09 = PIN_PB0; int t10 = PIN_PB1; int t11 = PIN_PB2; int t12 = PIN_PB3;
int t13 = PIN_PG0; int t14 = PIN_PC1; int t15 = PIN_PC2; int t16 = PIN_PC0;
int t17 = PIN_PG1; int t18 = PIN_PA7; int t19 = PIN_PA4; int t20 = PIN_PC3;
int t21 = PIN_PA6; int t22 = PIN_PA5; int t23 = PIN_PA3; int t24 = PIN_PA2;
// red leds
int t01r = PIN_PB4; int t02r = PIN_PB5; int t03r = PIN_PL0; int t04r = PIN_PG4;
int t05r = PIN_PH7; int t06r = PIN_PG3; int t07r = PIN_PL2; int t08r = PIN_PL1;
int t09r = PIN_PB6; int t10r = PIN_PB7; int t11r = PIN_PL3; int t12r = PIN_PL4;
int t13r = PIN_PL5; int t14r = PIN_PD0; int t15r = PIN_PD1; int t16r = PIN_PL7;
int t17r = PIN_PL6; int t18r = PIN_PD3; int t19r = PIN_PD6; int t20r = PIN_PD2;
int t21r = PIN_PD4; int t22r = PIN_PD5; int t23r = PIN_PA1; int t24r = PIN_PA0;
I have tried a for loop but getting c & 01, or t &01 into an unsigned char is proving problematic...
Yes. It will be called ControlLines[0] but you are probably going to do the same operation on a series of control lines so you would be using a loop instead of writing the same code 24 times:
I've iterated forward, backward and now moving forward again with the best (neatest) pcb design for the 2560, and the pins will not align in a nice sequential order for me this time.