Go Down

Topic: Rotary Encoders, button press. Help Needed (Read 637 times) previous topic - next topic


Hi, I have been playing with arduino for a few months now, and have come to a point in my project where I need some help.
I am trying to use the button press function for my Sparkfun Rotary Encoders. Currently I am using the following code to count the rotations,
but It doesn't specify how to use the button. It is currently wired up with one of the pins connected to ground and the other to digital pin 12, as shown in this example (not using arduino),

Do I need to re-wire that side of the encoder so that I can use it like a button as shown in the learning area of the arduino site.

any help will be greatly appreciated.


If you are counting rotations fine, leave that part alone.  Do not re-wire the 3 pin side of the encoder.

The button can be connected in either way depending on what you want to do with it.  So, what do you want to do with the button press?


Just enable the internal pull-up on pin12 and you'll be able to digitalRead() it.  It'll read LOW when the button is pressed.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Hi and thanks for your answers.
I want to be able to use it to count each press, but currently, it won't work with and of the learning examples.
Can anyone, show me exactly what I will need to do.
If I can get it to flash LED on the board I can do the rest, it's just getting the button to work.

As it is connected currently, (GND and PIN12) when ever I touch the metal chassis, the LED lights up, this makes me feel I have wired it up wrong. This using the learning button example.

Go Up