voltmeter wont read 0v

Just for completeness, the code should be

  vout = (value * 5.0) / 1023.0;

Since there are 1023 steps from 0V to 5V, not 1024, but in practice it isn't important as the ADC error is a couple of LSBs.