LED crazy


Closed Thread
Results 1 to 3 of 3

Thread: LED crazy

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    There's lots of ways to acomplish what you want, most of them involve some kind of PWM generating. Generating that PWM can be done with PBP's PWM command for a software-only-aproach or by the PICs hardware CCP module.

    If dimming that LED up and down is all you want then something quick and dirty like this might do the trick:
    Code:
    TRISB.7=0     'Set PortB.7 to output, connect LED here.
    DutyCycle VAR byte
    
    Start:
    For DutyCycle = 0 to 255
     PWM PortB.7, DutyCycle, 10
    Next
    
    For DutyCycle = 255 to 0 Step -1
     PWM PortB.7, DutyCycle, 10
    Next
    
    Goto Start
    That's one way...also have a look at the HPWM command and search this forum for Darrel Taylors software PWM routines.

    /Henrik.

  2. #2
    Join Date
    May 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Smile led crazy

    Thanks HenrikOlsson
    Thats what I was looking for.
    Very nice of you to help me.
    Now I can take this code you made
    and mess with it.
    You know like add more leds and mess with
    the fade time.
    Thanks again!

Similar Threads

  1. 12f675 making me a crazy person
    By Meriachee in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 16th September 2009, 22:55
  2. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 21:19
  3. For next loop using: Led var Byte
    By quester in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th March 2008, 11:16
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30
  5. can't even flash an LED
    By bruno333 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2005, 14:27

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