I2CEncoderV2.1 icon indicating copy to clipboard operation
I2CEncoderV2.1 copied to clipboard

Store multiple values in registers ?

Open nicolasvair opened this issue 1 year ago • 4 comments

Hi,

I have a question on how the encoder works. I'm doing a bluetooth midi controller and plan to have several pages of controls.

I read in the docs that the encoder have 4 adress bytes. Does it means that I can store 4 values ? Or are you using the 4 of them for one value ?

nicolasvair avatar Apr 27 '24 17:04 nicolasvair

Hello, I think you are referring to the CVAL, CMAX, CMIN and ISTEP register. They are 32bit register and they store 1 value. They use 4 register because a 32bit number is composed of 4 byte.

Thank you!

DuPPadotnet avatar Apr 27 '24 19:04 DuPPadotnet

Allright, that what I thought.

I have then another related question. What would be the benefit of storing the value in the register rather than in an arduino variable ?

Thank you

nicolasvair avatar Apr 27 '24 20:04 nicolasvair

The I2C encoder keep counting when you rotate the encoder even if you don't read through the I2C command. This can happens when your arduino is busy with other tasks. So in this way you will not miss the steps

DuPPadotnet avatar Apr 27 '24 21:04 DuPPadotnet

Oh ok. That makes sense.

Thank you ! Those controllers and led rings are really great and well made.

nicolasvair avatar Apr 28 '24 10:04 nicolasvair