Azzera filtri
Azzera filtri

rotary encoder with arduino and matlab

1 visualizzazione (ultimi 30 giorni)
john white
john white il 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:

Risposte (0)

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by