Servo Controller and Matlab
Confused
Posts: 5
I've been trying to figure out how to controll the servos using matlab and its COM interface.
What I whant to do is basically set the positions of the servos.
I get the basic ideas of the COM "language" like:
s = serial('COM3');
set(s,'BaudRate',2400);
fopen(s);
fprintf(s,'!SCVER?')
out = fscanf(s);
fclose(s)
delete(s)
clear s
But even the above doesn't seem to work properly.
If anyone has a good link, a good explanation·or some example code that would be much appreciated.
Thanks!
What I whant to do is basically set the positions of the servos.
I get the basic ideas of the COM "language" like:
s = serial('COM3');
set(s,'BaudRate',2400);
fopen(s);
fprintf(s,'!SCVER?')
out = fscanf(s);
fclose(s)
delete(s)
clear s
But even the above doesn't seem to work properly.
If anyone has a good link, a good explanation·or some example code that would be much appreciated.
Thanks!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
I have changed the Terminator for the COM object to CR because the default is LF. However:
fprintf(s,'!SCVER?')
fprintf(s,'/r')
out = fscanf(s)
out = !SCVER?
-> So after I scan the buffer it contains "!SCVER?"
out = fscanf(s)
out = 1.4/r
-> If I scan it again I get the above
This doesn't seem right
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10