Rotary H1 Values

I started playing with this module for the first time today. The first thing that jumped out at me is that when you turn it clockwise, the GetCount() values decrement and they increment when you turn counter-clockwise. Am I just being obsessive here or is this a bug? Of course, its easy to work around but I’m having a hard time believing this was intended since every knob I’ve ever turned increases (volume, etc.) whenever turned CW and decreases when turned CCW.

I have noticed that as well when I have started using this module, but I have not reported this behavior.

Question: is this rotary where you can push the regulator as a kind of enter/activate the rotary’s value ?

I guess, times the value with -1 has already crossed your minds …

Question: is this rotary where you can push the regulator as a kind of enter/activate the rotary’s value ?[/quote]
No. Although I would really like it to be the case; now I have to use a Button module.

@ iamin - oh, that’s a pitty.

There’s always the s/w debounce part and using direct a ‘normal’ rotary encoder.

You can look here for some infos on debouncing if need be:

and read more about some other rotary encoders here:

		public int GetCount()
            int count = this.Read2(Commands.LS7366_READ | Commands.LS7366_CNTR);

			if ((this.GetStatus() & 0x01) > 0)
				count = ~count;
				count &= 0x7FFF;
                count *= -1;

			return count;

Or remove the *-1 from the current GetCount method.

1 Like

[quote=“Sprigo”]Or remove the *-1 from the current GetCount method.

OK. So, now my curiosity is really high. Why would this be intentionally coded this way and chew up a few extra clock cycles? Is there some culture where its normal to increase values when turning CCW?

@ PiWi - I am not sure why you have linked a debouncing article. This module does not have any issues with debouncing. It is handled by a dedicated IC.

I have to side with ianlee74

As Spock would say… “Highly Illogical”

I didn’t (haven’t) dug that deep at the moment as it was late (very late)

Bit 1 of the Status byte is the sign bit so it looks like it was checking for a negative value and correcting it? Perhaps there’s an error on the datasheet but it does indicate 1 = negative, 0 = positive.

I picked up a couple of these modules this week and also noticed the ‘back to front’ nature.

[Edit] On second thought the datasheet is correct. This is simply an indication of the sign for the count and the code ensures that the sign is reported correctly.

In case you might want to use a rotary WITH an axial switch and need to do some debouncing (hw or sw) without the use of a dedicated IC.

@ ianlee74 - Take a look at the latest bitbucket source, it’s changed some since the last SDK: