@langwadt this time I am asking for solution x :p.
The fact:
Consider a microcontroller A that has an input pin B. This input pin is used to read if the external circuitry has an error by pulling the output voltage of an optocoupler. How an when this optocoupler set its output high is out of this subject. The optocoupler normally outputs 5V but if we add two diodes in series or a voltage divider we will get the 3.5V(ish) specified in the initial description. The pin B will also be used to trigger the calibration circuit. This circuit has a 12V relay which switch between the input terminals (normally on) to a 10V refference (normally off). The relay can also be a 5V, but again this is out of the scope since the MCU cannot control the relay directly due to insufficient current. At the MCU startup a self calibration cycle will be initialized and then the normal flow will continue. As you can imagine, in the normal flow an error on the external circuitry should not trigger the calibration circuit.
I know that this should not be done because a pin should be used for only one thing, but I ran off pins on the MCU.
P.S. for everyone, if you can suggest a simple I2C switch that can handle 100mA that is good enough for me. In other conditions I should stick with the traditional way, using transistors.
@soldar thank you for your appreciation. Unfortunately the provided solution will not work (the first one). Even if I reduce the optocoupler voltage from 3.5 to 2.5V and then use a voltage divider to divide by 5 this voltage, I will obtain 1V by the MCU trigger and 0.5V by optocoupler (external error). At 0.5V a BJT may still be in the saturation region and conduct a little bit. Maybe will conduct only 10mA, maybe only 30mA, but having this uncertainty it is enough to skip the solution. I will analize the trigger Schmit solution to see if this can be achieved by using only one dedicated transistor (maybe it is a transistro that can do this, although from what I know only specialized ICs can do this).