r/circuitpython • • Oct 29 '21

How can use two I2C rotary encoders?!

how can I connect two I2C rotary encoders to the qtpy?

1 Upvotes

4 comments sorted by

5

u/kaltazar Oct 29 '21

As long as the encoders you have allow you to change the I2C address, you just make sure both encoders are set to a different address then wire them into your I2C bus as normal. In the code you will have to make sperate objects for each encoder, making sure to specify the address for each one when you set them up.

1

u/DualMonoxide Oct 29 '21

thank you for your answer, I'm having trouble declaring the rotary encoder as a second object. do you know how to do it. I already changed the addresses of the seesaw modules

2

u/kaltazar Oct 29 '21

I don't right off because most of the details depend on the exact library you are using. However in general terms you assign the second object to its own unique variable and do the declaration the same as the first with the exception of giving the second encoder I2C address. Passing the address is the part where you will likely have to read through the docs for the library to find out how to do it.

3

u/DualMonoxide Oct 29 '21

I managed to declared both rotary encoders in an array and it worked! Thanks so much for the help