simulate a pin as connect nowhere

hello

there is a pin.

when the pin connected to GND,

it means move right

if the pin connected to nowhere,

no action happen

it was contolled by button switch originally

but I want to controll it with mouse

when the mouse move right, the pin is connected to GND

when the mouse don't move, the pin is connected to nowhere

such as connect the pin to arduino UNO's 3rd pin.

whenever mouse's rightward moving is detected,

3rd pin going to be GND

and when the mouse's moving is something else than rightward,

arduino UNO's 3rd pin works as connected nowhere

here is the problem

I think making 3rd pin act as GND is works by analogWrite(3,0)

but how can I simulate "connected nowhere"?

thanks for reading it

analogWrite(3,0) equates to sending a low (~0V) signal.
so how about analogWrite(3,255) to send out a high (~5V) signal?

or use digitalWrite(3, LOW) and (3, HIGH) to do the same.

thank you for your replying very much!
when I analogWrite(3,255)
and connect 3rd pin and 5v for experiment
voltage testing device say 1.7mV (I expect 0V)
this small voltage can be ignored?

What is "3rd pin"?
What do you have connected to what?

3rd pin is a pin which I want to simulate as connect nowhere
I think I solve the problem with your replying
(logic high or analogWrite(3,255))
thank you!

If this is an output pin that you want to look like it is connected to ground or nowhere then for ground you need to set it to be an output and set that output to a logic zero or LOW.
To simulate the nowhere, change the pin into an input, this will then be a very high impedance which is like nowhere.