Fade out LEDs question


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gl73 View Post
    I am pressing a button to get the different colors then the fade effect goes through all the colors as the final mode then there is an all off, so like 9 presses gets from red to fade then off. I am a bit embarrassed to post the code since it is pretty ugly to just blink some leds. I can e-mail it to you...
    http://web.ndak.net/jdgrotte/kromatoobz/kromatoobz.html
    Wish I had a movie to go with it...

  2. #2
    Join Date
    Dec 2005
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    That is great! Is this a product of yours? The menu/controller interface with more than one button easily impresses me. I am sure I'll be able to get more buttons for menus to work as I progress, hehehe. After getting the "On Interrupt" to finally work, blinking LEDs have become quite fun! Now to figure out how to have a hold button in the interrupt handler do what I want, so far no beans

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gl73 View Post
    After getting the "On Interrupt" to finally work, blinking LEDs have become quite fun! Now to figure out how to have a hold button in the interrupt handler do what I want, so far no beans
    I think the key you might be looking for is...keep the interrupt handler as short as possible. Set a flag, save a number, do something, just don't do much. Do the main thing (i.e. button press handling, mode changing, etc) in your main loop. If you're doing the fading using PWM and interrupts, then the only thing the interrupt should do is run the PWM and set the LEDs, nothing else. Check for a keypress in your main loop, and don't use any pauses to keep from getting 'double hits' on the buttons. When you detect a keypress, set a byte value and have it count down with the PWM interrupt and don't accept any keypresses until that counter is back at zero.

Similar Threads

  1. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  2. Max7219 question
    By jamied in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th December 2008, 16:33
  3. Use of a PIC
    By Edwardo in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd March 2007, 14:11
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. controlling leds with the switches
    By ilteris in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th October 2005, 21:02

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