I am going to use a couple of toggle switches and a rotary switch (11 positions), and I would like to ask some questions about how do I use them, for my purpose. I am making a keyboard device, so the signals should be interpreted as key press.
I did check tutorials about how to use a momentary switch; but with the toggle switch; I can't use the same logic, since the button goes off when you release pressure on it; while a toggle stay on until you turn it off again. My objective is to toggle the switch on, and have the signal being registered once only; instead of being always on. Then when I turn off the toggle switch, the signal get processed again. Basically I want to use the toggle switch as a momentary switch.
Same goes for the rotary switch: it has 11 positions, so I was thinking if it was possible to use it to trigger button press. To give an idea; I would like to have the rotary switch to behave like a throttle wheel that you may find on a boat; so at 0 (position 6 for example, which is the center of the rotary switch), if I turn it right one position; I press a button to increase speed of the boat; if I go one more on the right; the "increase speed" is pressed; but if I go back one position, the speed decrease.
I thought of keeping a variable that increase and decrease, based on the current position and previous position (so I know that if previous position was 6 and new position is 7, I need to press the speed increase, while if the position goes down, I need to press the speed decrease). Is this correct?
Thanks in advance for any suggestion you may have. This is my first attempt at using switches beyond the standard momentary switch with Arduino.