Hi there,
I noticed that, reading the analog ports from the serial monitor the value is very different depending the port (A0 or Ai). If I don't connect anything to the analog ports the A0 stays very stable on 1023, while the others are not so stable are around 850.
(By Mult+/- I understand + or - of a digital multimeter. Ai all other analog ports but A0)
I measured these values:
| Mult+ | | Mult- | | Value |
| - | - | - |
| 5V pin| | GND pin| | 4.9V |
| A0 pin| | GND pin| | 4.9V |
| Ai pin | | GND pin| | 0.02..0.03V |
After running this code:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(A0, OUTPUT); digitalWrite(A0,LOW);
pinMode(A1, OUTPUT); digitalWrite(A1,LOW);
pinMode(A2, OUTPUT); digitalWrite(A2,LOW);
pinMode(A3, OUTPUT); digitalWrite(A3,LOW);
delay(20);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
delay(50);
}
I get these results:
| Mult+ | | Mult- | | Value |
| - | - | - |
| 5V pin| | GND pin| | 4.9V |
| A0 pin| | GND pin| | 0V |
| 5V pin | | A0 pin | | 4.88V |
| Ai pin | | GND pin| | 0.01V |
| Ai pin | | 5 V | | 0.0V |
Running this cod:
void loop() {
// read the input on analog pin 0:
int sensorValue[10];
int delayTime = 10;
sensorValue[0] = analogRead(A0); delay(delayTime);
sensorValue[1] = analogRead(A1); delay(delayTime);
sensorValue[2] = analogRead(A2); delay(delayTime);
sensorValue[3] = analogRead(A3); delay(delayTime);
sensorValue[4] = analogRead(A4); delay(delayTime);
sensorValue[5] = analogRead(A5); delay(delayTime);
sensorValue[6] = analogRead(A6); delay(delayTime);
sensorValue[7] = analogRead(A7); delay(delayTime);
sensorValue[8] = analogRead(A8); delay(delayTime);
sensorValue[9] = analogRead(A9); delay(delayTime);
// print out the value you read:
for(int i=0; i<=9; i++){
Serial.print(sensorValue[i]);
Serial.print(" ");
}
Serial.println();
delay(100);
}
On the Monitor I get these values:
1023 787 668 693 562 473 405 357 310 291
1023 795 716 661 638 548 484 418 351 318
1023 802 748 686 697 612 554 481 398 354
1023 812 759 725 711 650 599 533 437 392
1023 822 760 758 695 661 614 565 462 424
1023 831 760 777 677 660 615 580 478 447
1023 837 765 773 680 658 615 585 492 462
So whatever I am doing the A0 behaves different from Ai. Why? What can I do to make them behave similar?
I am using Arduino Mega 2560.
Greetings,
Emoke.