"was" command


Closed Thread
Results 1 to 3 of 3

Thread: "was" command

  1. #1
    Join Date
    Jan 2010
    Posts
    88

    Default "was" command

    Hello All,

    Minor brain cramp trying to figure out a small coding problem. Probably an easy solution, but having trouble seeing it.

    I have a loop in my code that continuously monitors multiple inputs. These inputs are buttons, but the last one is an external input from an outside source.

    The buttons can be individually programmed to do either A or B depending on what the last input is doing. Button 1 can be assigned to do task A when the last input is high and Button 2 can be assigned to do Task B when the last input is high (and swapped at some later time).

    My dilemma is this: I have the code to say:

    if lastinput = 1 then ' if input is on,
    value = 1 ' then show on,
    else
    value = 0 ' else show off
    endif

    What I want to say now is:

    If lastinput was 1 and is now 0 then go do this.

    How do I go about doing a "was" command?

    Thanks,
    Tony

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: "was" command

    Maybe an edge triggered interrupt is what you need?

    Ioannis

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default Re: "was" command

    Code:
    If is <> was Then
      was = is
      If is = 1 Then
        go do something
      EndIf
    EndIf

Members who have read this thread : 1

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