Phaseshift analogRead wave

Inverting is different from phase shifting. Imagine a square wave that reads 0, 5, 0, 5... An inverted signal will read 0, -5, 0, -5... I want a phase shifted one - it must read 5, 0, 5, 0...

And yes, as mentioned, I am using a mosfet to create a 1.5 V square wave. The mosfet is switched using the PWM pin. This won't answer my question but could you please provide the code to get a 1.5V square wave from the nano?