Can the Arduino handle lots of variables?

In my code (Which is 99% based on Rougesciences excellent MIDI tutorial ) I have a lot of variables (108)
Will this bog the Arduino down?

//Buttons
int buttonPinOne = 2;               //choose the input pin for a pushbutton
int buttonValOne = 0;                    //variable for reading the button status
int buttonStateOne = 0;            //variable to hold the buttons current state
int bounceCheckOne = 0;            //variable for debouncing

int buttonPinTwo = 4;              
int buttonValTwo = 0;                   
int buttonStateTwo = 0;            
int bounceCheckTwo = 0;      

int buttonPinThree = 4;              
int buttonValThree = 0;                   
int buttonStateThree = 0;            
int bounceCheckThree = 0; 

int buttonPinFour = 4;              
int buttonValFour = 0;                   
int buttonStateFour = 0;            
int bounceCheckFour = 0; 

int buttonPinFive = 4;              
int buttonValFive = 0;                   
int buttonStateFive = 0;            
int bounceCheckFive = 0;

int buttonPinSix = 4;              
int buttonValSix = 0;                   
int buttonStateSix = 0;            
int bounceCheckSix = 0;

int buttonPinSeven = 2;               
int buttonValSeven = 0;                    
int buttonStateSeven = 0;            
int bounceCheckSeven = 0;            

int buttonPinEight = 4;              
int buttonValEight = 0;                   
int buttonStateEight = 0;            
int bounceCheckEight = 0;      

int buttonPinNine = 4;              
int buttonValNine = 0;                   
int buttonStateNine = 0;            
int bounceCheckNine = 0; 

int buttonPinTen = 4;              
int buttonValTen = 0;                   
int buttonStateTen = 0;            
int bounceCheckTen = 0; 

int buttonPinEleven = 4;              
int buttonValEleven = 0;                   
int buttonStateEleven = 0;            
int bounceCheckEleven = 0;

int buttonPinTwelve = 4;              
int buttonValTwelve = 0;                   
int buttonStateTwelve = 0;            
int bounceCheckTwelve = 0;



//Pots
int potPinOne = 0;                  //choose the input pin for a potentometer
int potValOne = 0;                //variable for reading potentiometer value
int mappedPotValOne = 0;          //variable for holding remapped pot value
int prevPotValOne = 0;               //variable for storing our prev pot value
int potTHRESHOLDOne = 2;            //threshold amount

int potPinTwo = 0;                  
int potValTwo = 0;                
int mappedPotValTwo = 0;          
int prevPotValTwo = 0;               
int potTHRESHOLDTwo = 2;  

int potPinThree = 0;                  
int potValThree = 0;                
int mappedPotValThree = 0;          
int prevPotValThree = 0;               
int potTHRESHOLDThree = 2;

int potPinFour = 0;                  
int potValFour = 0;                
int mappedPotValFour = 0;          
int prevPotValFour = 0;               
int potTHRESHOLDFour = 2;

int potPinFive = 0;                  
int potValFive = 0;                
int mappedPotValFive = 0;          
int prevPotValFive = 0;               
int potTHRESHOLDFive = 2;

int potPinSix = 0;                  
int potValSix = 0;                
int mappedPotValSix = 0;          
int prevPotValSix = 0;               
int potTHRESHOLDSix = 2;

int potPinSeven = 0;                  
int potValSeven = 0;                
int mappedPotValSeven = 0;          
int prevPotValSeven = 0;               
int potTHRESHOLDSeven = 2;

int potPinEight = 0;                  
int potValEight = 0;                
int mappedPotValEight = 0;          
int prevPotValEight = 0;               
int potTHRESHOLDEight = 2;

//Faders
int faderPinOne = 1;                  //choose the input pin for a potentometer
int faderValOne = 0;                //variable for reading potentiometer value
int mappedfaderValOne = 0;          //variable for holding remapped pot value
int prevfaderValOne = 0;               //variable for storing our prev pot value
int faderTHRESHOLDOne = 2;     //Threshold amount

int faderPinTwo = 2;                  
int faderValTwo = 0;                
int mappedfaderValTwo = 0;          
int prevfaderValTwo = 0;               
int faderTHRESHOLDTwo = 2;   

int faderPinThree = 3;                  
int faderValThree = 0;                
int mappedfaderValThree = 0;          
int prevfaderValThree = 0;               
int faderTHRESHOLDThree = 2;   

int faderPinFour = 4;                  
int faderValFour = 0;                
int mappedfaderValFour = 0;          
int prevfaderValFour = 0;               
int faderTHRESHOLDFour = 2;

Perhaps its time to think of using an array, lol?

Oh man, I went and I read about arrays, and yeah, that would be easier...
So my code would look like this?:

int buttonPin[11];
int buttonVal[11];
int buttonState[11];
int buttonCheck[11];

int potPin[8];                  
int potVal[8];                
int mappedPotVal[8];          
int prevPotVal[8];               
int potTHRESHOLD[8]; 

int faderPin[4];                 
int faderVal[4];             
int mappedfaderVal[4];           
int prevfaderVal[4];               
int faderTHRESHOLD[4];

Your arrays look perfect.

Variables take space from SRAM, and the chip has a limited amount of SRAM available. (See the main Arduino reference page for your model's SRAM size.)

An int is bigger than a byte. If your variable always falls within the range of 0 ~ 255, you can use a byte instead, and save the difference in space. Code will likely run a little faster, as well.

I hope this isn't throwing even more advanced ideas on top of your newfound understanding of arrays, but I think this is also a good time to learn about structures of variables.

I have no idea what you're doing with all these buttons or potentiometers, but I'll jot down a few bits and pieces of a program that uses an array of structures to organize similar data.

struct aButton {
    byte pin;
    byte val;
    byte state;
    byte check;
};

aButton buttons[11];

void setup() {
    ...
    buttons[3].pin = 8;
    buttons[3].val = 0;
    ...
}

void loop() {
    ...
    for (int i = 0; i < 11; i++)
        if (digitalRead(buttons[i].pin) != buttons[i].val)
            do_something_with_button(i);
    ...
}

One more thing!
If I do this:

if(buttonVal[0,1,2,3,4,5,6,7,8,9,10,11] == bounceCheck[0,1,2,3,4,5,6,7,8,9,10,11]){           //if val is the same then not a bounce
    if (buttonVal[0,1,2,3,4,5,6,7,8,9,10,11] == HIGH && buttonState[0,1,2,3,4,5,6,7,8,9,10,11] == 1) {   //check if the input is HIGH
     // digitalWrite(ledPinOne, LOW);         //turn LED OFF
      midiOUT(0x90, 60, 0); //Note ON (CH 1), middle C, zero velocity turns note off
      buttonState[0,1,2,3,4,5,6,7,8,9,10,11] = 0;
    }
    if(buttonVal[0,1,2,3,4,5,6,7,8,9,10,11] == LOW && buttonState[0,1,2,3,4,5,6,7,8,9,10,11] == 0){
     // digitalWrite(ledPinOne, HIGH);       //turn LED ON
      midiOUT(0x90, 60, 127); //Note ON (CH 1), middle C, velocity 127
      buttonState[0,1,2,3,4,5,6,7,8,9,10,11] = 1;
    }

  }

Will it check each button in the array individually, or will they all have to be pressed or something weird?

If I remember programming from forever ago Structures are just groups of variables, and in your code you are creating twelve groups of them with the
aButton buttons[11]; ?
And this will speed things up?

Also can I do something like:

buttons[0,1,2,3,4,5,6,7,8,9,10,11].pin = 8,9,10,11,12,13,14,15,16,17,18;

?

Also
I get an error from

buttons.val[0] = digitalRead(buttons.pin[0]);

error: request for member 'val' in 'buttons', which is of non-class type 'aButton [11]

Thank you for answering everything so far, I appreciate it.

Your array is of "buttons", so the reference should look like:

buttons[0].val= digitalRead(buttons[0].pin);

Benito: The arduino language doesn't contain any special array operators like some other languages, and you can only reference or operate on one array element at a time.

@ Groove Ahh, I cant believe I made such a dumb mistake, thanks.

@westfw Alright thanks, so even when I have to set the buttons has inputs I have to do them all separate?

yes, but since they are indexed numbers you could use a for loop

or if you want to dabble a bit in the "dark side" look up direct port manipulation on the home page

Also can I do something like:
Code:

buttons[0,1,2,3,4,5,6,7,8,9,10,11].pin = 8,9,10,11,12,13,14,15,16,17,18;

?

Not exactly, but you can do this:

buttons[] = { 8,9,10,11,12,13,14,15,16,17,18};

And it will be filled from the start (index 0), and to as many as needed.

In the case of a structure, you can do this:

struct aButton {
    byte pin;
    byte val;
    byte state;
    byte check;
};

// make a prefilled array structure called buttons with 2 elements 
aButton buttons[] = { {1,2,3,4}, {5,6,7,8} };

For assigning, you can do this, as with any variable:

...
aButton anotherButton;

void something()
{
  anotherButton = buttons[1]; // works, makes a copy of buttons[1].
 ... etc
}

But curiously, you cannot do comparisons, not even equal:

if (buttons[0] == anotherButton) Serial.print("they are alike!"); // will not work!

That would require to test each member (.pin, .val, .state, .check) at a time, it seems.

For equality, you could do "memcmp"