Help with GUI matlab to control a servomotor

1 次查看(过去 30 天)
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);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by