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".

6 Ansichten (letzte 30 Tage)
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

Antworten (1)

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

Kategorien

Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by