How to control a sustain pedal

I’m using a sustain pedal to switch between two plugins. The peal makes an immediate change - and I get clicks - so I would like it to be a fast fade instead, if possible.
Is it possible, and if so, how?

You use cc 64 to switch between variations?

I have the sustain pedal (connected to my Arturia Keyboard) switching the plugins in one particular rackspace.
Yes, it’s cc 64. But in this case it’s not switching varitaions, but rather toggling a widget which is freezing one reverb while unbypassing a 2nd reverb so that I can continue to have reverb while the first one is frozen. It’s working brilliantly except for the speed of the switchover which gives me a tiny click each time.

Bypassing and unbypassing is always fast.
When you want a smooth transition you have to use gain plugins and with scripting fade the levels of that gain plugins.

Sounds great.
Where can I find out how to do that?