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


Results 1 to 28 of 28

Threaded View

  1. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

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

    Code:
    if !flag then
        adcin 1, adcval   'read keys
        SELECT CASE adcval
          CASE < 10 : left=left+1:flag=1 'detect button presses
          CASE < 100
        @ NOP
          CASE < 130 : right=right+1 :flag=1'detect button presses
        END SELECT
    endif
    Something like that then?

    Ioannis
    Last edited by Ioannis; - 7th January 2022 at 20:40.

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, 08:37
  2. Replies: 42
    Last Post: - 18th March 2012, 23:02
  3. How come my DS18S20 code still works?
    By Wilson in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 30th July 2011, 02: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, 17:19
  5. ADC -how it works?, pic -
    By matias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2007, 21: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