rotary encoder with arduino and matlab

2 views (last 30 days)
john white
john white on 17 Feb 2019
hi
I am using a Rotar Encoder when I want to read the count of the encoder pulses in one direction it works good but when I turn the encoder shaft to the other direction the counting won't be decreasing and it would be increasing!!!!
this is the code that I write:
a=arduino('com9','uno','Libraries','RotaryEncoder');
encoder=rotaryEncoder(a,'D2','D3');
for i=1:1000
count=readCount(encoder);
fprintf('count: %d\n',count);
pause(1)
end
and this is the data sheet of the encoder:

Answers (0)

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!