Using mkr board to control the gain of a turbidity sensor

Hi, 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.

Cheers.

It's likely that the sensor can be controlled directly by a microcontroller but without a datasheet you can't be sure.

If the sensor is 5V and your MKR board is 3.3V you'll need some transistors between the two.