Design and Programming help - 0-10VDC input with 0-5VDC output

Bump:

So you're saying it does not invert?
Lets work thru an example.
You connect 5V, do a reading, get 1023 as a result.
Shift right twice (>>) to divide by 4.
Result is 255.
255 - 255 = 0;
analogWrite(0); should give 0V out.
Assumes the output is going thru a lowpass RC filter to smooth it out and not be the square wave that it actually is.

Say you put in 2.5V, do a reading, get 511 as a result.
Shift right twice (>>) to divide by 4.
Result is 127.
255-127 = 128
analogWrite(128); should give out ~2.5V.

Say you put in 1.25V, do a reading, get 256 as a result.
Shift right twice (>>) to divide by 4.
Result is 64.
255-64 = 191
analogWrite(191); should give out ~3.75V.

How are you wired up?