My project has 2 modes: one uses a speaker as output, the other uses a vibration motor. The user can choose which output to use by flipping a toggle switch.
My thought right now was to connect the toggle switch to a pin and to ground, then always read it to check if its on or off. Then use if/else statements to choose the output.
I haven't used toggle switches before. Is this how they are meant to be used? Will the connection I described work?