Avergaing Two Potentiometers Help

CoolJ:
It actually looks like you have copied some code to average the reading of one sensor. Then copied it again and tried to sum the average. That isn't going to work for obvious reasons.

You cannot just copy that same code twice and change the pin input variable and expect it to work.

I also have to wonder what, if anything, you understand about programming in C. Certainly you cannot have two functions called loop. You can have two loop functions, but they both cannot be named loop.(Not that what you wish to do requires more than one anyway.)

All variables need to be initialized at once. Not twice, not three times, one time.

Declared variables

const int numReadings = 10;

int readings[numReadings];       // the readings from the analog input



Probably better if the comments clearly state that this is a set of data. It's clear to people who already understand. Any teacher is going to want to know that **you** understand this. Remember that you need to store two setts of data though. Not just one. How will you accomplish this with this array? Add another dimension to the array is what I would do.



int index = 0;                          // the index of the current reading



Same here. How will you differentiate the array index of the other set of data? I feel I could go into arrays and their many uses, but it wouldn't do any good.



int total = 0;                           // the running total
int averageA = 0;                     // the average
int inputPin = A0;



This is all much the same. All of the variables for each set of data that corresponds to the analog input you are reading needs to be handled in turn. You will have more than one running total, average, input pin, Etc.

I am beginning to get a mental picture of this situation. I dearly hope I'm wrong and that you haven't been squandering your learning opportunity. I believe you have finally come to a point in the lesson plan where you can't just copy pasta your way to victory. From the state of what I see before me, you need to begin remedial learning and start back with the basics of programming. I would say your best course of action is to start from the beginning with a tutor.

Manipulating data with arrays is something that you will do a lot in computer programming. You can't expect us here to teach you in text how to program anymore than you can expect to learn it through osmosis.

Thanks for the input and I'm sorry for acting like that is the way I am but I am just frustrated trying to learn Arduino and my teacher suggested to ask the forum for help. I know that I am trying to "copy and paste my way to victory" in this situation but I would just like to let you know that this in no way describes my work ethic as a future electrical engineer. Thank you again for your criticism I am going to work harder to learn Arduino and C programming methods.