Porta=InitComm('Com1',9600);

juntas = [33, 34, 35, 37, 38];

pos = [0, 0, 0, 0, 0];
inc = 10;

while(1),
   msg=[juntas(1),pos(1)]
   fwrite(Porta, msg);
   msg=[juntas(2),pos(2)]
   fwrite(Porta, msg);
   msg==[juntas(3),pos(3)]
   fwrite(Porta, msg);
   msg=[juntas(4),pos(4)]
   fwrite(Porta, msg);
   msg = [juntas(5),pos(5),] 
   
   
   
   pos = pos +  inc;
   
   if ((pos(1) == 180)|(pos == 0))
        inc = -inc;    
   end
   
   disp('pressionar qq tecla');
   pause;
end

