analogRead to voltage

I currently have an Arduino Uno hooked up with an EasyDriver and a NEMA 17 stepper motor. I have a power supply that can be dialed in from -15V to 15V. I dial in 12 volts to power the EasyDriver. What I want to do is to have that voltage read to the serial monitor. The reason why I want that is so I can build some if else statements and have my motor spin clockwise if the voltage is less than 12 volts and spin counter clockwise if the voltage is greater than 12 volts. Right now I have that power supply hooked up to pin A0. How would I go about reading the voltage of the power supply? I think it would be something like this but I would need to know the right ADC.

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}

I would then take that voltage value and go from there with the stepper motor.

That's it.

You could also do

float voltage = sensorValue * (0.00488); // as you know its 5 over 1023. Maybe the compiler does that for us.

No you need to add a voltage divider from 12V down to 5 so you don't damage the IO pin.

The voltage to the ADC inputs must be less than Vcc (usually 5V) and greater than 0V. If you have -15V to +15V going in you will have to convert it to the 0 to +5v range. A simple circuit could do this, depending on what sort of accuracy you want. A transistor with its emitter held at 12V would conduct when the base gets to about 12.7V. Op amps or comparators would switch with less offset. You also need to build in a dead zone to avoid very high frequency switching at 12V.