fofro

I'm having trouble to read the voltage value of the potenciometer's wiper "leg".

I connected it to the 5V-GND of the Arduino, and connect the wiper into A0 analog pin. At 100ohms, I should have read 2.5V, but instead, I got 0,49V! I'm using Matlab instead of IDE.I set the A0 pin in two different ways to see if it was a syntax error :

but none worked as supposed.Therefore, I connected the Arduino's 5V to A0 to see if I would get 5V, no problem. But with the potentiometer it's inconsistent.

Do I really have to set A0 as input(I believe I dont) in order to "tell" Arduino to increase its impedance?Do I need to use any special potenciometer functions to read the values?(I believe I dont either)

0.49 is after you've done some math on it. What's the raw, unmodified value?

Which is another way of saying "post your sketch" please.

As a better electrical test, just use your multimeter to measure the wiper terminal voltage while it's wired up to the arduino and check the readings at the two ends of travel and while centered, and confirm that the meter reads 0, +5vdc, and +2.5vdc respectively.

0.49 is after you've done some math on it. What's the raw, unmodified value?

Which is another way of saying "post your sketch" please.

As a better electrical test, just use your multimeter to measure the wiper terminal voltage while it's wired up to the arduino and check the readings at the two ends of travel and while centered, and confirm that the meter reads 0, +5vdc, and +2.5vdc respectively.

Lefty

The returned value is about 100bytes(I don't recall the precise value) and to transform it into voltage, I just have to multiple it for 5 and divide it for 1023 due to the pin's resolution of 10bits. The expected value would be 512bytes, which is not happening...

I measured the two ends and the wiper terminal and I got the expected values of 0, 5 and 2.5V respectively.

This is the script I have been using to drive a DC motor with an Arduino Motor shield:

No trailing ;And not sure if integer math will work as truncation/rounding, will kill that calc, no?Or is matlab converting the components to floating variables. I can't even see wherethe potmcmt variable is declared?