Go Down

### Topic: Analog inputs are averaging? (Read 1 time)previous topic - next topic

#### rmaurer

##### Jan 08, 2013, 12:01 am
So, I have two analog inputs, on separate circuits, one should read 10 and the other 34, but they are both coming up as 22?

Code:
int loadcell;
int battery;

void setup()
{
Serial.begin(9600);
}

void loop()
{
loadcell = analogRead(0);
battery = analogRead(1);
Serial.print(loadcell);
Serial.print(" ");
Serial.println(battery);
delay(100);
}

?? Help

Thanks, Ryan

#### larryd

#1
##### Jan 08, 2013, 12:11 am
Diagram?
No technical PMs.
The last thing you did is where you should start looking.

#### retrolefty

#2
##### Jan 08, 2013, 02:18 am
Wiring schematic would be helpful. But take a digital multimeter and measure the voltages at analog pins 0 and 1 and see what readings you get at that point independent of your program.

Lefty

#### rmaurer

#3
##### Jan 08, 2013, 03:36 am
Checked with a multimeter, voltages are what they should be.  I dont know why the Serial monitor is showing them as averaged...  The diagram is real complex, not sure how I'd post it.  It has three batteries, a load cell, amplifier, and LEDs.  But the battery and loadcell are on totally different circuits.

#### retrolefty

#4
##### Jan 08, 2013, 03:44 am

Checked with a multimeter, voltages are what they should be.  I dont know why the Serial monitor is showing them as averaged...  The diagram is real complex, not sure how I'd post it.  It has three batteries, a load cell, amplifier, and LEDs.  But the battery and loadcell are on totally different circuits.

Well the output impedance of the signals (if too high) you are reading could be a factor, and if not that then your sketch is mangling the values before sending them out to the serial monitor.
So without wiring diagram and sketch code help will be just guessing.

Lefty

#### robtillaart

#5
##### Jan 08, 2013, 06:56 pm
Quote
?? Help

help!!

Analogports are A0 iso 0 and A1 iso 1

give this a try. Be aware that analog reads fluctuate ...
Code: [Select]
`int loadcell;int battery;void setup(){  Serial.begin(9600);}void loop(){  loadcell = analogRead(A0);  battery = analogRead(A1);  Serial.print(loadcell);  Serial.print(" ");  Serial.println(battery);  delay(100);}`
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#### Grumpy_Mike

#6
##### Jan 08, 2013, 07:14 pm
Try this:-
Code: [Select]
`void loop(){loadcell = analogRead(0);loadcell = analogRead(0);battery = analogRead(1);battery = analogRead(1);Serial.print(loadcell);Serial.print(" ");Serial.println(battery);delay(100);}`
It will help if the impedance of each input is too high.

Go Up