Here's the situation:
I have an Arduino mega 2560 and I'm trying to analogRead
from 2 different pins.
code:
void setup()
{
pinMode(A0, INPUT);
pinMode(A15, INPUT);
Serial.begin(9600);
}
void loop()
{
Serial.print("0:");
Serial.print(analogRead(A0));
Serial.print(" 15:");
Serial.println(analogRead(A15));
}
The voltage I'm trying to measure is arduino 3.3V supply connected directly to the ADC input pin and the result I get varies depending on the connection of the inputs:
Both inputs floating:
A0: 376
, A15: 376
A0 connected, A15 floating:
A0: 771
, A15: 655
A0 floating, A15 connected:
A0: 409
, A15: 696
A0 connected, A15 connected:
A0: 782
, A15: 780
What is the cause of this fluctuation?