Help with example button program


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Help with example button program

    Thanks for the help guys. The button and toggle commands just weren't working for what I needed. First of all, I couldn't get the button to debounce consistently, but mostly it wouldn't work even if it did because the toggle command did not toggle the two LEDs simultaneously. It would toggle the first LED upon the button press and then toggle the second upon button release. It also seemed to loop if you held the button down. I'm using a non-latching momentary switch thas intended to be activated with your foot, so it's incredibly bouncy. And it's activating a dual latching relay. I'm using LEDs now just to verify the program. So both LEDs need to toggle simultaneously upon pressing the switch and not do anything at all when you hold the switch down.

    I wrote my own debounce/toggle program. It sorta works. here's the thread: http://www.picbasic.co.uk/forum/showthread.php?t=19114

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Help with example button program

    Hi,

    > First of all, I couldn't get the button to debounce consistently, but mostly it wouldn't work even if it did because the toggle command did not toggle the two LEDs simultaneously.
    Out of curiosity....and for a possible learing experience, try putting a PAUSE 10 between the two TOGGLE commands and see what happens.

    > It also seemed to loop if you held the button down.
    Well, that is clearly documented in the manual. It's the autorepeat feature of the button command. Did you try changing the 40 to 255 as suggested earlier, that should have disabled the autorepeat.

    With that said, I don't think I've ever used the button command so I'm just going by what the manual says. I'll pop over to the other thread and see if there's something I can help with there.

    /Henrik.

Similar Threads

  1. [Help] PIC 16F886 with 9 button program with CCS
    By keviltran in forum General
    Replies: 1
    Last Post: - 8th October 2013, 21:40
  2. Toggle program branch ussing interrupot by button?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 14th September 2013, 09:58
  3. Replies: 1
    Last Post: - 23rd May 2009, 09:22
  4. button help
    By Kalind in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 14th October 2008, 13:12
  5. Program Code and Program Memory
    By DenFrod in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th February 2007, 14:51

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