Using a rotary encoder with arduino mega and MATLAB

I've tried to run the following example code I obtained from mathwoks website ( https://www.mathworks.com/help/supportpkg/arduinoio/ref/rotaryencoder.html ). 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.

3 comentarios

Menghan
Menghan el 31 de Jul. de 2017
Editada: Menghan el 31 de Jul. de 2017
Hi Derick,
Encoder support is added in R2017a MATLAB. Make sure you use the correct version of MATLAB to get the latest list of Arduino libraries.
Hope this helps.
Menghan
MATLAB Hardware Team - MathWorks
Thanks for your response, I never really understood where such an error was coming from until I was able to get my hands on R2017a.
Qais El-Bakaein
Qais El-Bakaein el 17 de En. de 2018
Editada: Qais El-Bakaein el 17 de En. de 2018
Hey, i have the same problem and I have R2017b, what could the problem be? thanks

Iniciar sesión para comentar.

Respuestas (1)

Akhilesh Thakur
Akhilesh Thakur el 31 de Jul. de 2017
This feature is introduced in R2017a. Check the version. If you are unable to do that check this link https://www.mathworks.com/help/supportpkg/arduinoio/quadrature-encoders.html. You need to go through this there are sample examples that can help you.
Best Akhilesh

Categorías

Más información sobre Arduino Hardware en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Jul. de 2017

Editada:

el 17 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by