%% Dynamixel RX-64 Pohyb kamery vlevo-vpravo
% Martin Zeman, 2009

function [command] = leftright (angle)
str1 = 'FF FF 01 07 03 1E';
str2 = '00 01';
a1 = dec2hex(mod(angle,256));
a2 = dec2hex((angle - hex2dec(a1)) / 256);
checksum = dec2hex(255 - (mod(42 + hex2dec(a1) + hex2dec(a2), 256)));
if length(a1)==1
    a1(2) = a1;
    a1(1) = '0';
end
if length(a2)==1
    a2(2) = a2;
    a2(1) = '0';
end
if length(checksum)==1
    checksum(2) = checksum;
    checksum(1) = '0';
end
command = sprintf('%s %s %s %s %s',str1, a1, a2, str2, checksum) %#ok