Arduino Serial Communication Error "Failed to open serial port COM3 to communicate with board Uno. Make sure there is no other MATLAB arduino object for this board. For Troubleshooting, see Arduino Hardware Troubleshooting".

2 visualizaciones (últimos 30 días)
More detailed description: I am using the arduino board in a GUI format to run a piece of custom lab equipment. The code i'm using to connect the port is as follows:
if true
% handles.a=arduino('COM3','Uno','libraries','Adafruit/MotorShieldV2');
set(handles.setuptxt,'String','Arduino Connected')
end
The script was working only yesterday, and the only changes made since then were that it is currently running on a PC instead of a mac (just upgraded the machine this is running on), and changed the mac style com port ('/dev/*') to the PC style ('COM*').
When I first run the code immediately after connecting the board to my PC, it runs fine, but once it has run through the GUI script once, and loops back to the beginning of the process, the script crashes, and gives the above error message. The only thing the Hardware troubleshooting page tells me to do is make sure the board in use is supported, drivers are up to date, and that there are no other objects for the arduino. I have checked, and drivers are up to date, and its an Uno that has been running perfectly until now.
I know for a fact the system works, as until yesterday it was running upwards of 1000 cycles through the same script just on a mac instead of a PC.
Any help is appreciated.
~PJ

Respuestas (1)

HAMZA ABBASI
HAMZA ABBASI el 24 de Jun. de 2018
write clear all command in the first line of code

Categorías

Más información sobre Device Driver Blocks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by