MATLAB Answers

I am trying to get data from an incremental rotary encoder by using Simulink and Workspace.

M. Tarik Copoglu 님이 질문을 제출함. 12 Jul 2018
최근 활동 SCOTT HARDING 님이 편집함. 30 Jul 2019
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);
count = readCount(encoder);
pos = mod(count,180);
fprintf('Current knob position: %d\n',pos);

  댓글 수: 1

If this question has been answered, can you please share it? I have the same problem.

로그인 to comment.

답변 수: 1

how to install rotaryEncoder library in matlab?

  댓글 수: 0

로그인 to comment.

Translated by