Variable IS NOT inbetween a given set?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
NateMac
 
Posts: 32
Joined: Fri Jun 13, 2014 10:52 am

Variable IS NOT inbetween a given set?

Post by NateMac »

I'm trying to do a check to be sure a variable IS outside a range.

An IF statement that would check if 'x' is outside the range of 'y' plus or minus 1000.

I think I'm just over thinking this, thoughts?

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Variable IS NOT inbetween a given set?

Post by Franklin97355 »

if ((x<(y-1000))or (x>(y+1000)))

User avatar
NateMac
 
Posts: 32
Joined: Fri Jun 13, 2014 10:52 am

Re: Variable IS NOT inbetween a given set?

Post by NateMac »

franklin97355 wrote:if ((x<(y-1000))or (x>(y+1000)))
Ya know what, I had that and I thought it was wrong for some reason, needed the gym and a fresh eye, thanks for the help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”