delay=1.5;

disp 'Init'

applyjoint(H,1,1,[50 50 50]);

applyjoint(H,1,3,[1 0 0]);

pause;

while (1)

    disp 'Start'
    
    applyjoint(H,1,0,[0 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 0 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 -50 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 70 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 -50 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 -50 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[0 0 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 -20 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[50 -20 -70]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
    applyjoint(H,1,0,[-50 70 50]);

    pause(delay)
    pos=readjoint(H,1,0);
    if(isempty(pos))
        keyboard;
    end
    
end