PDA

View Full Version : What is the code for between two numbers?



noobmuncher
12-23-2009, 02:01 PM
Hello,

I am working on a stabilization code using the Memsic accelerometer and some code that Beau helped me with last week (topic and code can be found here http://forums.parallax.com/showthread.php?p=865261) and I am running into a problem. I am having a LED turn on whenever one of the axises becomes higher then 15 degrees above level. Now this works very well on two of the four vectors (sorry if that is the wrong terminology) however on the two vectors that require me to the LED turn on when it is less then -15 and greater then -90 I am having a problem.
With the propeller how do you go about saying:
if e == <-15 and >-90 ?

Thank you for the help!

Mike Green
12-23-2009, 02:08 PM
outa[ledPin] := e < -15 and e > -90

or

if e < -15 and e > -90

noobmuncher
12-23-2009, 03:13 PM
Thanks alot Mike, as usual your the man with the answers!

Happy Holidays.