Propeller and Rotary Encoder
xanadu
Posts: 3,347
I got this rotary encoder http://www.sparkfun.com/products/10982 and....
Will this object http://obex.parallax.com/objects/24/ work with the push button function?
Thank you.
Will this object http://obex.parallax.com/objects/24/ work with the push button function?
Thank you.
Comments
The button is just treated like a normal button, independent of the encoder.
I'd think the object you linked to would work the same way, but I'm not sure about the "grey code" part of SparkFun's description. I thought grey code was different than just a normal quadrature encoder output (but I'm not sure).
It's Spin Zone #6.
I based my Mecanum robot's encoder code on JonnyMac's code.
The push button shorts the common anode of the LEDs to the middle pin of the group of five pins.
Connect the center pin to a Prop IO pin set as an input (with a pull-down resistor on the Prop pin). When the pin reads a high level, the button has been pressed.
These are different than the other encoders with push buttons I've used.
The right angle RGB encoders SF sells use the same sets of pins for the button.
[video=youtube_share;7TQxMgffmAE]
Thanks for the link to the article. In that article the encoder's push button shows a switch circuit, mine does not. I'm still completely stumped by that part of the datasheet
I was wondering what that pin was for haha, it's just not very obvious in the datasheet. Thanks Duane!
I couldn't make sense of that datasheet. I just tested pins with my mulit-meter until I found a pair that shorted with the button pressed. I wasn't expecting one of the button pins to be shared.
The button can only be used as a normally low button unlike a normal push button that can be used either normally low or normally high.
Besides the pull-down resistor on the IO pin connected to the button, you might need a series resistor between the button and the Prop if you're powering the LEDs with more than 3.3V.
Thanks Mark.
After a bit more reading, I see a device I had thought produced Gray code doesn't. Apparently one of the key features of Gray code is only one bit position changes at a time, unlike binary which can have changes in many postions as it is increased or decreased by one.