matlab function for arduino

2 Ansichten (letzte 30 Tage)
john white
john white am 13 Mär. 2019
Kommentiert: john white am 14 Mär. 2019
I want to use matlab function to write code for Arduino boards
in the matlab function I have written this :
function [count1 count2 count2]=fcn
but it showed this error:

Antworten (2)

Madhu Govindarajan
Madhu Govindarajan am 13 Mär. 2019
Based on the error it looks like you are attempting to use MATLAB Function block within a Simulink Model. In this approach, you cannot use arduino function and other MATLAB Support Package for Arduino functions as this workflow is completely different from Simulink Support for Arduino.
If you post details about your project, experts might be able to assist you with selecting the appropriate workflow.
  1 Kommentar
john white
john white am 13 Mär. 2019
actually I want to control 3 dc motors with encoders , so I have a matlab function to create a controll output signals and get the encoders position and velocity as inputs so I have used three matlab function blocks one of them is using for control function , one is used to read the encoders position and velocity and the last one is used to write the voltage of the motors and get the output signals of the control block as the input signals

Melden Sie sich an, um zu kommentieren.

Madhu Govindarajan
Madhu Govindarajan am 14 Mär. 2019
I think you are better off using the Simulink workflow to perform controls and not use the MATLAB Support package for Arduino functions in MATLAB function blocks. Given that comment, if you want to control DC motors from an Arduino people usually use a Motor Control board or are using direct PWM signals.
So I propose you create a new question in Maker Community here mentioning details of your hardware setup including what motors you have, what is the controlling method (see above), what encoders are you using etc. This will get you the right answer the fastest.
If you are looking for generic examples, here are some links -
  1 Kommentar
john white
john white am 14 Mär. 2019
is there any way to read the encoder pulses(or position and speed of the encoder) in simulink?

Melden Sie sich an, um zu kommentieren.


Community Treasure Hunt

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

Start Hunting!

Translated by