Coding a KY-040 Rotary Encoder on a Raspberry Pi Pico - Detailed Explanation & Step by Step Code
GurgleApps
0:00 / 0:00
Coding a KY-040 Rotary Encoder on a Raspberry Pi Pico - Detailed Explanation & Step by Step Code
24 167 просмотров · 5 лет назад
GurgleApps
9,81 тыс. подписчиков
24 167 просмотров · 5 лет назад
A step by step tutorial on how a KY-040 Rotary Encoder works using MicroPython code on a Raspberry Pi Pico or any Microcontroller of choice.
More Info
https://gurgleapps.com/learn/electron...
★ Please 👍 like, subscribe & comment to our channel, it is really appreciated. 🙏
If you like our work you may want to help us with the costs to keep producing and buy us a pizza 🍕 the link to buymeacoffee.com : https://www.buymeacoffee.com/GurgleApps. Thanks as always for your support.
✨The code can be found at:
https://github.com/gurgleapps/rotary-...
00:00 Introduction
00:15 Cost of KY-040 Rotary Encoder
02:17 How a KY-040 Rotary Encoder works without code
03:19 Explanation of Rotary Encoder Pins and how to connect them to the Breadboard
05:14 KY-040 Rotary Encoder hooked up to a Raspberry Pi Pico
05:21 Explanation of the Micropython Code
06:28 Explaining irq in the code
07:15 Testing out the code using the Rotary Encoder
08:00 Getting rid of repeats
08:35 Binary Shifts
11:24 Testing out the code with no repetitions
14:00 Creating the code for clockwise and anti-clockwise turns
15:19 Testing the above code
16:14 Putting all code above into a class and saving it onto Microcontroller device
20:27 Using the class created above in a new file
21:18 Running the file and testing if the class works
21:52 Back in Class to modify the code some more to simplify things
22:57 Back into the file that has imported the Class written above to incorporate changes
24:56 Back in the Class to make the code more robust
28:30 Switch detect function including detection of press and release of switch
30:22 Testing the Press and Release of the Rotary Encoder Switch
✨Videos mentioned in this tutorial are
⁕How a Breadboard works • Breadboard - What is it? - How does it work?
⁕Pico Pong • Fun Game Alert! How to Make Pico Pong with...
⁕Binary And Hexadecimal how to convert to any number base • What is Binary and Hexadecimal? & How to C...
✨Parts can be obtained from Amazon
https://amazon.co.uk/shop/gurgleapps - UK
https://amazon.com/shop/gurgleapps - US
We have an affiliated partnership with Amazon, any money (pennies or cents) we make goes into our University or College fund.
#raspberryPiPico
#microPython
#raspberryPi