digital switch ? with arduino . how to do it

That indeed always works if you choose a relay that can handle the voltage and current.

Cons of that:
-Slow, so you cannot switch it fast
-Probably way over complicated for a lot of cases