Notifications
Clear all

Rotary encoder demo

4 Posts
2 Users
0 Likes
729 Views
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

Some days I feel really stupid, and today is one of those days.  I have a need to use a rotary encoder in a project and was reviewing the video about them on the Dronebotworkshop youtube channel. The article for this video is what I referenced for the test code. https://dronebotworkshop.com/rotary-encoders-arduino/#Introduction

Since I'm using a Seeeduino Xiao instead of an Uno, I made the changes to the pin numbers used and started playing with the code.  I've checked my wiring and the pinout definitions several times, but My CCW and CW output is the opposite of what is happening in the video. Can there be any differences in the rotary encoders?  Mine came in a box of sensors and looks identical to the one in the video.

Ideas??

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
Quote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

The simplest fix for this is to switch CLK and DT connections, but not sure why I had to do that. Anyone else experience this?

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1085
 

@jfabernathy  That is odd, as I suspect that the encoder you are using is probably the identical one I used. Mine also came in one of those "37-sensors" kits.

Of course, as it's been almost two years since I made that video my memory of it is essentially non-existent - I can't even remember what I worked on last week! And unlike yourself, I don't have the bourbon to blame for that LOL, just old age.

I would think that another fix could be to just reverse the if statement on line 53?

And, this is embarrassing, but currently, I don't even know where my rotary encoders are! I know I have several of them but I'm in the process of moving parts from the workshop into my new storage cabinets, and somehow I've lost track of them. So I can't check to see if they have different pinouts.

😎

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

I know enough now to fix it, but it would be nice to understand it. No big deal though. Thanks.

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote