My code for ADC button handling, it works, but can it be slimmed down?


Closed Thread
Results 1 to 28 of 28

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    With 10 or 20 keys, how do you handle the event of more than one key being pressed at the same time?

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


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    By clever selection of ADC resistors.
    This had been solved long time ago, and not by me

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    Recent posts got me thinking. Are you designing something with a bunch of buttons, each with a specific functionality? Or are you trying to do something more akin to a key pad? If you're using a standard key pad there are set-ups using resistors to create a narrow voltage range with the press of any individual key. That only requires one analog input to read any key press.

    https://aws1.discourse-cdn.com/ardui...2_542x500.jpeg

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    12 buttons is ok with 8 bit adc . with 16 the last row gets down to 2 or 3 counts separation , a bit close for comfort in my view
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    At current stage, I'm looking for more efficient and small code
    for ADC key handling.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    Doesn't post#2 with the use of Select Case do what you want with the least code/var usage?

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: My code for ADC button handling, it works, but can it be slimmed down?

    No it does not.
    It does not do "do not repeat action until user releases and pushes key again"

Similar Threads

  1. Long / short press button...but reading ADC
    By fratello in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 10th July 2016, 09:37
  2. Replies: 42
    Last Post: - 19th March 2012, 00:02
  3. How come my DS18S20 code still works?
    By Wilson in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 30th July 2011, 03:59
  4. 12 bit or higher ADC on a PIC that works with PBP?
    By Brandon in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th November 2007, 18:19
  5. ADC -how it works?, pic -
    By matias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2007, 22:54

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