the reason is I'm playing around with an accelerometer that is giving me very slight values
and I'm checking with the reference voltage that is going into the accelerometer.
I've seen that on some tutorials tom igoe is using digital pins with his pulseIn function to detect the data from the accelerometer...however i've hooked my dual axis to 2 arduino analog pins
and it's voltage reference to another arduino analog pin so I can check what Vin really is.
I know I could do that with a multimeter but I'm doing so that I can have a double reference
now for your solutions in fact does seem mathematically interesting
are you suggesting this?
Vfloat = analogRead (VinPin); //reads 665.6
Vint = (int)(Vfloat);
Serial.print(Vint); //prints 665
Vfloat = analogRead (VinPin); //reads 665.65
Vint = (int)(Vfloat*1000);
Serial.print(Vint); //prints 665650
another doubt is: to convert it to the 5 volt range I will have to multiply that to (5/1024)
is that correct?
Vint = (int)(Vfloat*1000*(5/1024));
Serial.print(Vint); //prints 3250 which means 3,2 V
that would be what my multimeter displays.
thanks as usual