dual analog input reading issue

For an antenna tracking project I am having two antennas give me a signal strength in volts and then depending on which antenna has a greater signal it will turn a servo to the left or right. The problem I am getting is that it will not accurately read the voltage from the antennas.
I have attached the file for my antenna tracker. Any help would be greatly appreciated.

Antenna_tracker.ino (1.42 KB)

You need to use the Servo library to control servos, not analogWrite.
In the Arduino IDE menu, go File -> Examples -> Servo and look at the example sketches.

Thanks for the advice. However the issue I am getting is that when I plug the voltage in from antenna one into a0 and then plug it into a2 i get different readings. I also get different readings when i plug in both of my antennas voltages into the arduino uno.

Which antennas? How is it wired?

They probably aren't perectly matched. If there's a consistent bias, then your code will need to subtract that from one antenna.

MorganS:
Which antennas? How is it wired?

They probably aren't perectly matched. If there's a consistent bias, then your code will need to subtract that from one antenna.

The thing is its using rssi (radio signal strength indicator) from a reciever unit which outputs 0 to about 1.6 volts. I realize that one may be giving a larger signal than the other. My problem is that when I plug in the Rssi from both recievers it changes that value of the rssi read by the arduino on the rssi that wasp plugged in first.

What kind of antenna are you using? They can interact if close enough together.

Arctic_Eddie:
What kind of antenna are you using? They can interact if close enough together.

i'm using helical atennas but they are not transmitting they are recieving. Besides they are always turned on when i plug the rssi into the arduino so that would not be the problem.

Antenna coupling can occur regardless of whether they are transmitting or receiving.

Also, helical antennas are not radially symmetric, especially short ones, so you may have a pattern issue when off axis.

Arctic_Eddie:
Antenna coupling can occur regardless of whether they are transmitting or receiving.

Also, helical antennas are not radially symmetric, especially short ones, so you may have a pattern issue when off axis.

Even if this was happening it wouldn't cause the analog inputs to display different numbers when i plug the antennas rssi into the arduino uno. So do you guys know what might be causing that?

pinMode(10, OUTPUT); // missing

delay(10);
Two successive readings is ok for high impedance sources, but I don't see the need for delays.
Is the source impedance >10kohm?
Leo..

Wawa:
pinMode(10, OUTPUT); // missing

delay(10);
Two successive readings is ok for high impedance sources, but I don't see the need for delays.
Is the source impedance >10kohm?
Leo..

I dont think the impendance is over 10k. I could however be wrong.

Even if this was happening it wouldn't cause the analog inputs to display different numbers when i plug the antennas rssi into the arduino uno.

True, but it's something to consider if you see problems with the tracking accuracy.

What's your power source?

INTP:
What's your power source?

A 2cell lipo battery. It powers both the recievers and the arduino uno.

Can't make sense of your code. You should throw in comments to explain what the point is of the things you wrote.

Not familiar with your antennas, or your wiring, are your readings off when a servo is not connected?
You say powering the receivers, meaning they're both plugged into the same voltage source?

But you're saying when all you have is the arduino, and a single antenna, and nothing else, the reading is different based on what analog in pin you use? If that's the case then I think somewhere in your confusing code, these values are getting messed with before they hit the serial monitor.