'Sin example basic_scale=4000 distance = basic_scale points = 1500 start_y = 0 tablestart=0 ' create the table points for normal cam FOR i = 0 TO (points - 1) x = i / (points - 1) ' TABLE(tablestart + i,start_y + distance * (x - SIN(2 * PI * x) / 2 / PI)) TABLE(tablestart + i,start_y - distance * SIN(2 * PI * x)) NEXT i
' create the table points for start cam FOR i=0 TO INT((points-1)/4) index=INT(tablestart+i+3*(points-1)/4) TABLE(2000+i, TABLE(index)-distance) NEXT i ' create the table points for end cam 'FOR i=0 TO INT((points-1)/4) ' TABLE(3000+i, TABLE(INT(2*(points-1)/4))) 'NEXT i
' set the variables tablestop = tablestart + points - 1 moveax = 0 linkspeed = 10 linkdist = 5 ' Set the speed on the axis to be moved SPEED AXIS(moveax) = linkspeed
DEFPOS(0) AXIS(moveax) ' First move to the balance position TRIGGER CAM(2000,2000+INT((points-1)/4),1,linkdist/4) AXIS(moveax)
VR(0)=1 VR(1)=1 counter=0 WHILE VR(0)=1 ' perform the move CAM(tablestart,tablestop,VR(1),linkdist) AXIS(moveax) WAIT LOADED counter=counter+1 IF counter>=3 THEN SPEED AXIS(moveax)= 25 IF counter>=8 THEN SPEED AXIS(moveax)=10 VR(1)=1.3 ENDIF IF counter>=11 THEN VR(0)=0 'Stop CamGen Sector1 WEND