How many times the loop turns for Darrel's "Kylon" LED chaser?


Results 1 to 7 of 7

Threaded View

  1. #2
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: How many times the loop turns for Darrel's "Kylon" LED chaser?

    Copy-paste screwed up the code, here it is:

    Code:
    Speed       CON 24        ; Smaller=Faster
    TracerSpeed CON 15        ; Smaller=Faster Left/Right
    Brightness  CON 255       ; Tracers DutyCycle
    DrainSpeed  CON 30        ; Smaller=Shorter Trail
    BAM_COUNT = 5
    
    
    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
          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
    Last edited by CuriousOne; - 14th November 2021 at 09:03.

Similar Threads

  1. how to "shift" a data into led matrix display ?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th January 2015, 17:09
  2. Replies: 0
    Last Post: - 14th November 2013, 04:32
  3. Overflows "counter" in a loop
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 11th September 2010, 10:26
  4. Replies: 2
    Last Post: - 22nd January 2008, 15:25
  5. LED "capacitance" won't get lower
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 3rd May 2007, 21:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts