Arduino Issue: I cannot run any of my code. 'To create a new connection, clear the existing object.'
33 views (last 30 days)
I have only just begun to learn how to work with arduinos in matlab. My code will not run past the third line, so here are the first few lines:
ard_UltraS('COM4', 'Mega2560','Libraries','Ultrasonic') = arduino;
Matlab gives an error at the third line:
"MATLAB connection to Mega2560 at COM4 exists in your workspace. To create a new connection, clear the existing object."
I have tried clear all, clearvars, clearing that specific variable, restarting matlab, restarting my computer, and different USB ports. With each of these attempts i get the same error. Is there anything to clear the variable I haven't tried? or some way to make sure that the arduino is disconnected?