As far as I know the inputs for ICs are not necessarily in Ground state when they are left floating. However, I would only be interested to input a voltage when the switch is turned on. How can I achieve the ground state while the switch is not turned on?