bike wheel controlling midi clock

For any sensor, especially if it is a switch, you need to make sure that when the sensor is not 'on' that it is actually 'off' and not a floating input. This means that you will need to implement a pull down resistor as part of your circuit when the switch is not connected. Conversely, if you are planning a normally on switch, the logic is reversed and you need a pull up resistor as the switch will switch to zero volts.

For a mechanical switch you will also need to take care of switch bounce.

For both of these there are plenty of references in the forum and online.