Borrar filtros
Borrar filtros

problem to drive 2 servos with servo object????

1 visualización (últimos 30 días)
kwstis xoustoulakis
kwstis xoustoulakis el 14 de Sept. de 2015
Comentada: Walter Roberson el 16 de Sept. de 2015
function[] = ServoAngleNew(Theta1,Theta2)
pause(2);
a = arduino('COM4');
s = servo(a,9,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
s = servo(a,10,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
writePosition(s, Theta1);
writePosition(s, Theta2);
end
i want to move my robot arm with 2 servos and when i call ServoAngleNew with 0 or 1 my arm does not moves correctly, simply do a tremulous. i try to drive one servo and works two or three servos do not move, any help??? thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de Sept. de 2015
function[] = ServoAngleNew(Theta1,Theta2)
pause(2);
a = arduino('COM4');
s1 = servo(a,9,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
s2 = servo(a,10,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
writePosition(s1, Theta1);
writePosition(s2, Theta2);
end
  2 comentarios
kwstis xoustoulakis
kwstis xoustoulakis el 15 de Sept. de 2015
Editada: kwstis xoustoulakis el 15 de Sept. de 2015
thakns walter , its woriking ! but my arm moves abruptly! i dont know why
Walter Roberson
Walter Roberson el 16 de Sept. de 2015
That two second pause sounds too long to me. Also, you should create the arduino object and servos outside the function and pass them in to the function, which should concentrate on updating the position. You are recreating the server objects every time with this code.

Iniciar sesión para comentar.

Categorías

Más información sobre Multiobjective Optimization 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