Ok, try adding a few lines:
This should increment your Cycle variable after a full left swing.Code:Speed CON 24 ; Smaller=Faster TracerSpeed CON 15 ; Smaller=Faster Left/RightBrightness CON 255 ; Tracers DutyCycleDrainSpeed CON 30 ; Smaller=Shorter TrailBAM_COUNT = 5 Cycle VAR BYTE ;Count Full Cycles Main: if LoopCount = TracerSpeed then ; __[ Cylon/Kitt Scanner ]__ LoopCount = 0 BAM_DUTY(NextLED)=Brightness if TraceDIR then ; if scanning left NextLED = NextLED - 1 if NextLED = 0 then TraceDIR = 0 Cycle = Cycle + 1 IF Cycle = xx THEN Do Something Cycle = 0 ENDIF else ; else scanning right NextLED = NextLED + 1 if NextLED = BAM_COUNT-1 then TraceDIR = 1 endif endif FOR Idx = 0 to BAM_COUNT - 1 ; Drain all dutycycles IF BAM_DUTY(Idx) > 0 then BAM_DUTY(Idx)=BAM_DUTY(Idx)*DrainSpeed/(DrainSpeed+1) ENDIF NEXT Idx pause Speed LoopCount = LoopCount + 1 GOTO Main




Bookmarks