I am using an MKR board to control the gain of a turbidity sensor. There are 4 gains and 2 control lines. The two control lines of the sensor are internally pulled up to 5V so the 4 gains can be achieved by pulling the control lines low or leaving them in their pulled up state at 5V.
My question is; can this be achieved by simply setting a pin as output and then pulling the pin low which will pull the gain line low however how do i allow the pin to float so as to leave the gain line in its pulled up state or is just setting the pin high OK? Do i need to have a diode or maybe a resistor on the output of the pin to protect it?
Note that i am trying to avoid having to use relays.
Any help is much appreciated.