Multiple inputs for one output

Does anyone have example code for two inputs for one output? Ex: First input to servo, Using one potentiometer. Second input to same servo, using 2nd potentiometer. The goal is to have the math worked out by the arduino and have it find the mid point between the two potentiometers when both are in use. Right now there is a lot of gittering because well, It's trying two things at once. Thx in advance.

Shadowbuddy518:
Right now there is a lot of gittering because well, It's trying two things at once.

Not necessarily. Servos also jitter when not properly powered. How are you powering the servo?

Anyway, is this what you're looking for?

int data1 = analogRead(pot1);
int data2 = analogRead(pot2);

float finalData = (data1 + data2) / 2.0;

servo.write(finalData,0,1023,0,180);

Power_Broker:
Anyway, is this what you're looking for?

I believe there is a map() missing from that code.

And I would not bother with a float - I can't imagine that the servo would notice any extra detail.

...R

Robin2:
I believe there is a map() missing from that code.

Oops, yes I forgot to put it in. Here is the revised code:

int data1 = analogRead(pot1);
int data2 = analogRead(pot2);

float finalData = (data1 + data2) / 2.0;

servo.write(map(finalData,0,1023,0,180));

Just wondering, isn't it possible (and simpler) to wire the two pots together as voltage divider and then read the midpoint directly? That way you need only one input and no additional code.