Hello everyone …I have the following in my code and it was suggested that I use arrays instead …
int buttonState = 0;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
int sensorValue = 0;
int outputValue = 0;
int sensorValue1 = 0;
int outputValue1 = 0;
int sensorValue2 = 0;
int outputValue2 = 0;
int sensorValue3 = 0;
int outputValue3 = 0;
int sensorValue4 = 0;
int outputValue4 = 0;
int sensorValue5 = 0;
int outputValue5 = 0;
int sensorValue6 = 0;
int outputValue6 = 0;
int sensorValue7 = 0;
int outputValue7 = 0;
int sensorValue8 = 0;
int outputValue8 = 0;
int sensorValue9 = 0;
int outputValue9 = 0;
int sensorValue10 = 0;
int outputValue10 = 0;
This way you can rearrange hardware pins and add pins with virtually no need to alter the rest of the code but adding a new line of , D5 (or any other pin name) in the array.
If you keep using loops and arrays that way you can shorten your code and cut on code maintenance considerably.