# KY040 rotary encoder - counting within NR

**URL:** <https://discourse.nodered.org/t/ky040-rotary-encoder-counting-within-nr/2548>\
**Category:** General\
**Created:** [25 August 2018 00:43 UTC](https://discourse.nodered.org/t/ky040-rotary-encoder-counting-within-nr/2548 "2018-08-25T00:43:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![RKF](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@RKF](https://discourse.nodered.org/u/RKF)\
**Post date:** [26 August 2018 07:17 UTC](https://discourse.nodered.org/t/ky040-rotary-encoder-counting-within-nr/2548/6 "2018-08-26T07:17:39Z")

</div>

Hello Colin - Sorry I didn't mention the stepper motor node - it was an afterthought.

Anyway I'm pleased to say that the node **_pythonshell_** and a neat little piece of python code ([https://www.raspberrypi.org/forums/viewtopic.php?t=140250](https://www.raspberrypi.org/forums/viewtopic.php?t=140250)) has solved my problem. I now have the rotary encoder connected directly to the Raspberry Pi with a limit of 0-100 (perfect for PWM control on a _ **rpi\_gpio\_out** _ node.

I appreciate your suggestions and will see if I can make that a more suitable solution.

Rod

---

_[View the full topic](https://discourse.nodered.org/t/ky040-rotary-encoder-counting-within-nr/2548)._
