Help with GUI matlab to control a servomotor

1 visualización (últimos 30 días)
FRANCISCO JOSÉ DEL MORAL CONDE
FRANCISCO JOSÉ DEL MORAL CONDE el 23 de Abr. de 2020
Hi, I would like to know if someone could help me to solve this error: "MATLAB connection to Uno at COM3 exists in your workspace. To create a new connection, clear the existing object."
I am working with a slider to move a servomotor and I don´t know how to solve it, I have tried to "clear all" in the last line of the function and it still no working. This is the code:
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
global position
global pos
position=get(handles.slider1,'Value');
pos=double(position);
assignin('base','pos',position);
a = arduino('COM3','Uno','Libraries','Servo');
assignin('base','arduino',a);
s = servo(a,'D2');
assignin('base','s',s);
writePosition(s,pos);
  1 comentario
FRANCISCO JOSÉ DEL MORAL CONDE
FRANCISCO JOSÉ DEL MORAL CONDE el 23 de Abr. de 2020
It works once and then it works if I delete the variables "s" and "a" or do a "clear all".

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by