Ext encoder button
-
Hi all
I’ve successfully got a KY040 rotary encoder working with the m5Stack ext- encoder unit.
I can register rotations but the part I haven’t made work is the push button - which is a straightforward contact button
There is an input for it on the ext encoder marked as Z but I can’t find any documentation on how I read this button and there seem to be no functions in the class to handle it.
Does anyone have any idea how I handle this?
Thanks in advance
-
@louisandthecat
In robotics and CNC the Z input is the third phase of the encoder usually to tell the controller that you have gone around once.
You have a KeyStudio encoder with only two phases and the third is the press to click.
The library reads this as:
#define UNIT_EXT_ENCODER_ZERO_PULSE_VALUE_REG 0x60
#define UNIT_EXT_ENCODER_ZERO_MODE_REG 0x70
Pushing it should Zero out the counts.
What controller are you using?
And what IDE are you programming in? -
@teastain Thank you - I had misunderstood what the Z was for. Because on the ky040 the middle pin is for the "switch" functionality (i.e. pushing down on the encoder) I assumed it was for this. I realise now that I need to treat that as a button and take it off to a different pin, which I know how to do.
Thanks for your help!