hello
im trying to operate robotic snake that have 13 servos with the pololu 16 servo controler
using matlab. i already acomplished that with c# program that i built.
the conection threw matlab is by the following steps:
1.building a look up table
2.sending each value at a time after packing it as mini ssc2 mode
the problem is that program always stops after few values
i can send alot more values before it stops when i send it to 1 servo only
it seems that there is a memory problem or synchronization problem with the matlab and the pololu
function simulation(port,LUTable)
clc
%openning port
s=instrfind;
fclose(s);
try
disp(['Try connecting to port: ’ port]);
s = serial(port, ‘BaudRate’, 2400,‘InputBufferSize’,4096,‘OutputBufferSize’,4096)
fopen(s);
catch
disp(['Failed to connect with: ’ port]);
end
s.FlowControl = ‘none’;
%creating a packet according to the Look Up Table and writting it to the
%port
n=size(LUTable);
for i=1:n(1) %rows
for j=1:n(2) %columns
A=Create_Packet(j,LUTable(i,j)); %creating the data to servo controler (servo no,angel)
Write_To_Port(A,s);%writting the packet A to port object
end
end
fclose(s);
delete(s);
function A=Create_Packet(Servo_No,Servo_Pos)
A=[255,Servo_No,Servo_Pos];
end