I build a potentiometer myself and connected it to the GND, 5V and an Analog pin of an arduino Uno like you would do with a regular potentiometer. However, due to the mechanical construction of my potentiometer it could be that the analog pin is suddenly disconnected for a second (just a bad connection) I'm totally fine with this for this setup but I would like to be able to measure when this is happening. At the moment when the analog pin disconects I ofcourse get fluctuating values from analogRead(). How could I make a circuit that when the analog pin disconnects I get a constant value? Normally you do this with a pull-up/down resistor but I don't think this is possible in this case since the analog pin needs to connect directly to the variable resistor right?