How can I control servo motors via Simulink and arduino MEGA 2560 hardware with normal mode and real time sync
3 views (last 30 days)
I'm trying to control servo motors via a matlab function on simulink through and Arduino MEGA 2560 board (image below of the simulink model). I know the matlab function works as when I simply 'run' the function on normal mode it works however when I attempt to deploy it to hardware I get the error: ## Failed to generate all binary outputs. I can control the motors using External mode(though not with this model) but not in Normal mode, are there certain configuration settings I should be using or is this not at all possible with the Arduino board?
I would also like to know if it is possible to work with arduino hardware using the real time sync, I have tried to do this however it seems that arduino can only use the code generation ert.tlc which does not work with the real time sync.
I am using MATLAB 2016a and the most recent version of the Arduino Target hardware add-on. The matlab code takes the xyz position of an object and using inverse kinematics turns that into theta 1-4 for a robot arm, which then sends the the theta value to the motors via the Arduino MEGA2560. Thanks for your help, Josie.