# Blinkt module + rotary encoder?

**URL:** <https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677>\
**Category:** Support\
**Created:** [January 17, 2022, 4:58pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677 "2022-01-17T16:58:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattDC](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@MattDC](https://forums.pimoroni.com/u/MattDC)\
**Post date:** [January 17, 2022, 4:58pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677/1 "2022-01-17T16:58:49Z")

</div>

Have never used a rotary encoder for any project before, but does anyone have any solutions, or would it even be possible to use a rotary encoder to change the brightness of a Blinkt module on the fly?

I haven’t seen much, and rotary encoders on PI in general seem to be a bit of a mystery.

Did find this code on github that looks like it would be a good starting point:

> **[GitHub - nstansby/rpi-rotary-encoder-python: Simple class to efficiently...](https://github.com/nstansby/rpi-rotary-encoder-python)**
>
> Simple class to efficiently monitor a rotary encoder on a Raspberry Pi - GitHub - nstansby/rpi-rotary-encoder-python: Simple class to efficiently monitor a rotary encoder on a Raspberry Pi

And this post about connecting the Blinkt to a switch / button:

> [@Use Blinkt to show door open or closed](https://forums.pimoroni.com/t/use-blinkt-to-show-door-open-or-closed/3633):
>
> How would I code Blinkt to show red if a door’s closed, and green if it’s open? I can do the magnetic switch OK, but can’t figure the code to get Blinkt to respond to changes in GPIO status. Thank you.

Previously I was looking into the gpio zero library which seems to have good encoder support, and a simplified command structure, but I wasn’t having any luck getting anything to work from there. Better success with rpi.gpio

I think this should be fairly simple, but am having trouble getting started. Any additional tips would be greatly appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [January 17, 2022, 7:27pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677/2 "2022-01-17T19:27:03Z")

</div>

Have a look see here, for the encoder  
[Adafruit Learning System](https://learn.adafruit.com/search?q=encoder)  
And here for the Blinkt  
[Welcome — Blinkt! 0.1.1 documentation (pimoroni.com)](http://docs.pimoroni.com/blinkt/)  
You want to look at the `blinkt.set_brightness(brightness)`  
brightness: 0.0 to 1.0

I’d do something like `blinkt.set_brightness(b)`  
Then change the value of the variable (b) with the encoder.

---

<div class="post-metadata">

**Author:** ![DarrenHill](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/darrenhill/32/771_2.png) [@DarrenHill](https://forums.pimoroni.com/u/DarrenHill)\
**Post date:** [January 17, 2022, 7:41pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677/3 "2022-01-17T19:41:10Z")

</div>

One suggestion I would make is perhaps to consider changing the colour rather than the brightness.

It can be done as noted above, but personally I find the Blinkt to be blindingly bright at anything much above its minimum setting (0.05). So whilst it would work to adjust the brightness, you may well end up getting dazzled.

Actually coding for Blinkt in Python3 is dead easy. The examples will take you a long way, and if you get stuck the community here can help you along.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [January 17, 2022, 8:45pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677/4 "2022-01-17T20:45:50Z")

</div>

Basically it’s a single row of eight APA102 (also known as DotStar) RGB LEDs.

---

<div class="post-metadata">

**Author:** ![Richard238](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard238](https://forums.pimoroni.com/u/Richard238)\
**Post date:** [January 17, 2022, 10:09pm UTC](https://forums.pimoroni.com/t/blinkt-module-rotary-encoder/18677/5 "2022-01-17T22:09:42Z")

</div>

I have a couple of rotary encoders on a radio, for tuning and volume control.  
Search online for Bob Rathbone Pi Radio to see how they’re configured.
