Using AND OR operators in combination


Closed Thread
Results 1 to 5 of 5

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Using AND OR operators in combination

    Hi,
    Have you tried
    Code:
    (Y >= 0 and BUTTON1 = BUTTONPRESS) OR (Y = 1 AND BUTTON2 = BUTTONPRESS) OR (Y > 2 AND BUTTON3 = BUTTONPRESS)
    or perhaps
    Code:
    ((Y >= 0) and (BUTTON1 = BUTTONPRESS)) OR ((Y = 1) AND (BUTTON2 = BUTTONPRESS)) OR ((Y > 2) AND (BUTTON3 = BUTTONPRESS))

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Using AND OR operators in combination

    I too am not sure why the first example from shahidali55 didn't work. Seems all the () are in place. Of the 2 from Henrick I think the second will be best.

    Having said that, Even if it works, I am not sure you will save code space using it. It will take a lot of ASM to make that statement.

    Another idea may be to go back to your original post and make the common lines a subroutine. this way the pause1000 will only be coded once and you won't have the complicated until expression.

    Of course you will have to verify by looking at the compiled size.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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