Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Other questions >> Other Wiring questions >> analog in does not work right
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1271860187

Message started by Armyn on 04/21/10 at 14:29:47

Title: analog in does not work right
Post by Armyn on 04/21/10 at 14:29:47
I've tested my board and the examples for digital ports worked just fine, however, when i tested the analog input and output ports, it doesn't seem to work right, the values being displayed on the serial monitor doesn't seem to match with the voltage inputted. Does anyone know what the problem may be? Thanks!!!

Title: Re: analog in does not work right
Post by barragan on 04/21/10 at 20:07:55
Please check this, http://wiring.org.co/reference/analogRead_.html analogRead read values between 0 and 1024 where 0 is about 0volts and 1023 about 5volts.
analogWrite is PWM (pulse width modulation) This is turning a digital output ON and OFF very
quickly to simulate values between 0 and 5 volts. If the output is 0 volts for 90% of the
time and 5 volts for 10%, this is called a 10% duty cycle. It emulates an analog voltage of
0.5 volts. An 80% duty cycle emulates a 4-volt signal:
Does this help?

Title: Re: analog in does not work right
Post by Armyn on 04/22/10 at 03:03:02
Yes, I understand how it works, however, as I've tried the potentiometer and photoresistor examples... I think the values being displayed does not match the real voltage inputted into the analog input port, because even though I am not turning the knob on the potentiometer, the values fluctuates from 1023, 900+... down to 500+, whereas it should only display a particular value. Thanks! 

Title: Re: analog in does not work right
Post by barragan on 04/22/10 at 06:33:12
Value fluctuation is normal by +-2 or 2 but not that big, there must be something wrong with your potentiometer, or your connections, a loose cable etc, also with disconnected pins and then reading them. Please provide information on your system, board (where did you get it), wiring version etc.
What type of potentiometer etc.

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.