Arduino: read different voltage values in a range from -12 to +12V
Figure 1. The voltage levels to be detected.

Since you never have to detect 0 V you can treat any voltage below 6 V as -12 V.







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 2. Level converter circuit. D1 protects the ADC against negative voltage inputs. The R1 / R2 divider gives an output of 5/12 times the input voltage.

On your logic you could set thresholds of 10.5 V, 7.5 V and 3 V for each of the analog 'windows'. For a 10-bit ADC these would correspond to \$ 1024 \frac {10.5 \times 5}{12} \$ for the 10.5 V threshold, etc.

If you have the comparator then you could use this to detect each positive going edge - set the threshold to 3 V (1024 * 3 / 12) - and after a short delay sample the voltage.

Note that I chose 7k and 5k to make the voltage divider ratio blatantly obvious. Choose some standard values close enough to do the same job.