Is there a way to overwrite simulink encoder block pins?

1 visualización (últimos 30 días)
Lachlan Downie
Lachlan Downie el 23 de Oct. de 2022
Respondida: Dhruv el 21 de Feb. de 2023
Hi! I'm having some issues using 'Simulink Support Package for Arduino Hardware' with my Arduino Uno and Arduino Motor Shield Rev3.
The support package includes a built in encoder block to read the position of a motor, however for the Uno it locks the encoder pins to Pin 2 and Pin 3, but the motor sheild uses pin 3 as pwm control for the motor duty cycle. I'm trying to use pins 2 and 4 for my encoder, leaving pin 3 for the pwm conrtrol, but the encoder block does not allow this.
Any support, advice, or workaround would be greatly appreciated.

Respuestas (1)

Dhruv el 21 de Feb. de 2023
The best possible solution which could help work out this issue is trying to use a different microcontroller that has more available pins or a built-in hardware encoder interface. (I would recommend Arduino Mega or Due)
Following is the list of Arduino Board/Digital pins usable for interrupts:
  • Uno, Nano, Mini, and other ATMega328-based boards - 2, 3
  • Mega, Mega2560, MegaADK - 2, 3, 18, 19, 20, 21 (20 and 21 are not available when they are used for I2C communication)
  • Micro, Leonardo, and other 32u4-based boards - 0, 1, 2, 3, 7
  • Nano 33 IoT - 2, 3, 9, 10, 11, 13, A1, A5, A7
  • Due - All digital pins


Más información sobre Arduino Hardware en Help Center y File Exchange.




Community Treasure Hunt

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

Start Hunting!

Translated by