I was trying to run simulink model connected to ARDUINO MEGA 2560. I get the following error message :
'The call to realtime_make_rtw_hook, during the after_make hook generated the following error: Could not connect to specified Arduino board. 2560 Verify that your board is connected to your host, and that the host COM port number and baud rate set in the model match the port settings in Windows.'
I manually set the COM port number in the model to match the port settings in Windows. I ran a=arduino('com1') before running simulink model and it passed. After running the model and the above error message, I tried a=arduino('com1') in command window again and got the following error:
'Open failed: Port: COM1 is not available. Available ports: COM3. Use INSTRFIND to determine if other instrument objects are connected to the requested device. Error using arduino (line 83) Could not open port: com1 '
A similar question in the forum was resolved by overwriting toolsinfodataArduinoMega2560.p in MATLAB/Targets/arduinomega2560/+realtime/+installer folder. I have .m file of same name instead of .p file in that folder. But replacing it with .p file didn't work aswell.
How to resolve this issue? Thanks