switching between two outputs
Here's a solution using a LM397 comparator and a quad 4066 analog switch:



Because the input is slowly rising, I have added just a little hysteresis to the  comparator input.  The comparator trips on the input reaching 4.99v, comparator input, but doesn't turn off until the input falls below 4.89v.  The trip points are controlled by the three resistors R1, R2, and R3.  Here is the formulae used:

$$Vh =\frac{Vs*R2}{\frac{R1*R3}{R1+R3}+R2}$$

and

$$Vl = Vs * \frac{\frac{R2*R3}{R2+R3}}{R1+\frac{R2*R3}{R2+R3}}$$

Vs is the 10v supply Vh is the upper threshold, and Vl is the lower threshold.

Here are the same formulas suitable for input to a spreadsheet if you want to experiment with the values:

= ((A10*A2) / (((A1*A3) / (A1+A3)) + A2))

= A10 * ((A2 * A3) / (A2+A3)) / (A1 + ((A2*A3) / (A2+A3)))


where A1..A3 are the resistor values R1..R3, and A10 is the 10v supply.  The final values used were adjusted to reflect actual 1% resistor values available.

I show the 10v for the reference  (top of R1) tied into the main supply; you may want a separate more accurate reference.  Also, I have not included decoupling caps for the two ICs; they should be added.  Less important than digital ICs doing fast switching, but always a good idea.

Note I have used all four analog switches.  When the analog switch for the selected voltage is off, then I grounded the line rather than leave it floating.