I am using Simulink togheter with an Arduino Mega 2560 to control a motor with encoder. The encoder has 200 steps per revolution. My aim is to use external mode in order to get out data into the Simulink scope.
Earlier, when not using the Simulink blocks, this worked fine using attachInterupt
. Now it does not work since Simulink does not have that option. I have tried two methods:
- use the digital input blocks and trigger > too slow
- use the serial block togheter with an extra arduino (uno) that Only handles the encoder signal (this extra arduino is not programmed in Simulink) and sends the pulses to the main arduino (the baudrate does not seem to the limiting factor, instead it is the fact that the block only handles uint8) > also too slow
I cannot see the generated code in my Simulink license, and I would prefer a solution where blocks are used. Is there a work-around??
Any tip is appreciated!