Hi everyone.
Imagine you have two electrodes. Imagine you have a potentiometer for moduling an output, i.e. analogWriting in these two electrodes, using a transistor (when output is on, it is PWM signaling the electrodes----It should be as a DC motor speed regulation).

Imagine, that as they are electrodes, there can be two failures over time: they can do a short, or they can open circuit… So, you can do an alarm with an analog read, reading voltage in in these two electrodes, so, you use another analog in port to read these values.

While working without any failure, the analog value of potentiometer, and the analog value of the reading of electrodes, should keep some relation, some linearity…

It doesn’t happen. Values for the analog values of the readings for acting as alarm, are so different, that I can not use them.

So, what does it happen?
PD: If I read with a multimeter, when I turn the potentiometer, the reading in the electrode has all values stables, from 0 to5… But the analog read of Arduino is completely alternating values:…

So, the idea is to have an analog read from a PWM output. So, “is it posible to have an analog read from an output, where the output is a PWM output”?..and of course, values to be stable…

valled=108valpot=307
valled=888valpot=307
valled=0valpot=307
valled=398valpot=307
valled=426valpot=307
valled=211valpot=307
valled=888valpot=307
valled=432valpot=307
valled=408valpot=308
valled=209valpot=308
valled=435valpot=308
valled=889valpot=308
valled=274valpot=309
valled=888valpot=307
valled=297valpot=308
valled=372valpot=307
valled=889valpot=307
valled=399valpot=305
valled=888valpot=308
valled=307valpot=310
valled=412valpot=307
valled=0valpot=307
valled=373valpot=312
valled=889valpot=307
valled=125valpot=307

Your title suggests two inputs are not reading at same time, but you describe a problem on not reading a digital PWM output with a analog input. I'm assuming on the same device.

No two things can happen at the exact same time on a single ATmega328 device, its one at a time but fast.

Microprocessors are faster than multi meters. If you want to see the same thing as your multimeter you will have to average the reading over a set time.

To get a 50 % output in pwm at 1/10 a sec the digitial output would be full on for 1/10 a sec full off then next 1/10 then repeat the on off cycle for 1 sec. but your input will see the output at the exact moment you ask it. so if its was at 100% on and its going to 0% on it will read what it sees at that exact moment. the only way i know of is to average your input at the same rate as your output.

Do not dream it's not possible to have the same precision with a voltmeter and with ADC from a micro-controller. The micro-controller uses general modules, the voltmeter uses ASIC (Application Specific Integrated circuit).

You should read the datasheet of your micro-controller and you'll see that there are different scanning errors. Your actual measurements are not between 307 and 310 but rather between 302 and 315.

[u]Also Arduino boards are for beginners, not for professional use.[/u] They have be very poorly designed for analog measurements. Atmel recommendations have not been met (missing an inductance between Vcc and AVCC) and Aref track is noisy by others tracks inside the board, so input board capacitor on Aref (board pin) is useless. If you have a UNO you can improve the quality of the measurement by welding a 100 nF capacitor the back of the board directly to the socket between Aref ([u]socket[/u], not board) and GND ([u]so[/u][u]cket[/u], not board)

Warning if the measurement become stable (I checked it) you will always have the scan uncertainties. Some are systematic, it is possible to make a calibration to remove them, others are random and it is not possible to eliminate them.

You only get 300, did you choice the voltage reference for the ADC? Default = Vcc Internal = 1,1 V +/- 0.1V External : Max Vcc, min 1,1 V The more you get a measure close to 1024, the best the quality of the measurement will be.