I am making a controller for my child; to be used in a video game on PC.

I did get a 11 position rotary switch, few toggle switch and a couple of potentiometers. Now, I did check few tutorials and I can see that most of them implement momentary switch; so I am trying to work a strategy to implement the other switches and the potentiometers. As board I am using a teensy 3.1

  • for the rotary switch I was thinking to connect the right 5 poles to the same signal, and the same with the left 5 poles; so all but the center pole will be connected, and if I turn it right is like if I am pressing the + button (like to increase the speed of a car), and - button if I go the other way. Is this acceptable or the signal while switching position may be missed or give me incorrect results?

  • For the toggle switch; can I just implement them in the same way as a momentary button? So when I enable the switch (so the circuit is open), a keyboard press message is sent, while when I disable the switch, the button is pressed again?

  • What about the potentiometer? Is there a way to have the buttons pressed when I rotate it in a direction or another? These are not rotary encoders so they stop at one point; and I was thinking that they could be helpful as a way to move through menu.


Some solutions that I did implement:

  • I did connect resistors between each pole of the rotary switch, up to the last one, skipping only the common pole for obvious reasons. Then I connected the first notch to positive, the last notch to negative and the common pin to one of the analog input of the controller; so when I read the values; I get finite steps between each notch; and as such, I can implement the various increase and decrease values that I need.

  • The toggle switch has been implemented as matrix; so I use 2 pins for each of them, and watch for the hold and release state, to figure out what to do.

  • The potentiometer was implemented as analog axis directly in the microcontroller; straightforward data read from the analog input, with a bit of normalization to avoid fluctuation.

  • \$\begingroup\$ If this is a satisfactory solution you can accept it to indicate that the problem is solved. \$\endgroup\$ – Transistor Jan 3 '18 at 19:46
  • \$\begingroup\$ It is, although I would rather see if anyone else post something better than this solution \$\endgroup\$ – rataplan Jan 3 '18 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.