Shop OBEX P1 Docs P2 Docs Learn Events
What is the code for between two numbers? — Parallax Forums

What is the code for between two numbers?

noobmunchernoobmuncher Posts: 124
edited 2009-12-23 08:13 in Propeller 1
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!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-23 07:08
    outa[noparse][[/noparse]ledPin] := e < -15 and e > -90

    or

    if e < -15 and e > -90
  • noobmunchernoobmuncher Posts: 124
    edited 2009-12-23 08:13
    Thanks alot Mike, as usual your the man with the answers!

    Happy Holidays.
Sign In or Register to comment.