I have a signal input like the sine V1 that is modified by the arduino and transformed it into a square signal. The value of the output depends on the value of a voltage reference given by a potentiometer. Both, the input signal and the reference are ADC inputs in the arduino. I put an interruptor just like the image, assuming PWM2 as arduino, and when the i put the interruptor in the position of the image i see the same voltage on the output as the potentiometer voltage reference, as is this where connected. Why is this happening ? can i do this in a different way ?
simulate this circuit – Schematic created using CircuitLab