rotary encoder with arduino and matlab

2 visualizaciones (últimos 30 días)
john white
john white el 17 de Feb. de 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:

Respuestas (0)

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by