There are couple of LabVIEW examples for a robot mounted switch
here, but it just depends on what kind of electrical switch you choose.
You can also use the default LabVIEW Dashboard to choose an autonomous mode. Examples are on the Basic tab of the Dashboard and have corresponding code in the default project.