I am trying to get data from an incremental rotary encoder by using Simulink and Workspace.
Mostra commenti meno recenti
Hi there, I am using a incremental rotary encoder and trying to read position changes in time. I have tried several ways to do it Simulink by using memory and compare blocks but it did not work as I was expected. Then I tried the rotary encoder tutorial from MATLAB Support Package for Arduino Hardware and it worked flawlessly. After that, I decided to use the realtime Workspace data in Simulink by using simin block. Unfortunately, I couldn't find any ways to read realtime workspace data by using simin block. If there are any ways to read realtime data from workspace, or rotary encoder directly by using Simulink, that would really help me. I shared the tutorial code below.
clear all
a = arduino('COM5','Mega2560','Libraries','RotaryEncoder');
channelA = 'D2';
channelB = 'D3';
encoder = rotaryEncoder(a,channelA,channelB);
resetCount(encoder);
while(1)
count = readCount(encoder);
pos = mod(count,180);
fprintf('Current knob position: %d\n',pos);
pause(0.01);
posvar=pos;
end
3 Commenti
SCOTT HARDING
il 30 Lug 2019
Modificato: SCOTT HARDING
il 30 Lug 2019
If this question has been answered, can you please share it? I have the same problem.
Jason Wang
il 28 Mar 2020
I have the same problem
Hasan Falah
il 2 Mag 2020
I have same problem, could you please share the answar of this problem.
Risposte (1)
Kamlesh Vaghela
il 3 Ago 2018
0 voti
how to install rotaryEncoder library in matlab?
Categorie
Scopri di più su Arduino Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!