Using a rotary encoder with arduino mega and MATLAB

2 views (last 30 days)
I've tried to run the following example code I obtained from mathwoks website ( ). I get the following error when I try to create a rotary encoder object:
>> a = arduino('COM4','Uno','Libraries','rotaryEncoder');
Invalid value 'rotaryEncoder' for Libraries. Valid libraries are
'Adafruit/MotorShieldV2, I2C, SPI, Servo, ShiftRegister'.
Do I need to install something in order to use the rotary encoder library, if so what library should I install ? I've already installed the MATLAB and SIMULINK support packages for arduino. Thanks in advance for your help.
Qais El-Bakaein
Qais El-Bakaein on 17 Jan 2018
Edited: Qais El-Bakaein on 17 Jan 2018
Hey, i have the same problem and I have R2017b, what could the problem be? thanks

Sign in to comment.

Answers (1)

Akhilesh Thakur
Akhilesh Thakur on 31 Jul 2017
This feature is introduced in R2017a. Check the version. If you are unable to do that check this link You need to go through this there are sample examples that can help you.
Best Akhilesh


Find more on Simulink Support Package for 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!

Translated by