Announcement

Collapse
No announcement yet.

Simple logic for numeric variable

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple logic for numeric variable

    What did I do wrong? When an analog input goes over a value (2.45), I want it to subtract that value and multiply by another value (5.8823) otherwise set variable to zero.

    GM 2 bar MAP sensor is 2.45V at ambient pressure. 0 vacuume, 0 boost. Then its 5.8823 PSI per volt.
    Attached Files

  • #2
    If anybody else cares

    My solution was to 2 logics in configurator. First sets a variable to 1 if greater than 2.45, anti-then sets variable to 0. Separate logic does the math and multiplies by first variable to set boost PSI variable. Only issue now is at exactly 2.45 it sets a value instead of zero. 2.449 or 2.451 it is not a problem so I don't think it will ever land on it long enough to display.

    Comment


    • #3
      Originally posted by ACCLR8N View Post
      My solution was to 2 logics in configurator. First sets a variable to 1 if greater than 2.45, anti-then sets variable to 0. Separate logic does the math and multiplies by first variable to set boost PSI variable. Only issue now is at exactly 2.45 it sets a value instead of zero. 2.449 or 2.451 it is not a problem so I don't think it will ever land on it long enough to display.
      I dont know what's going on with the mp3car forum updates, but I didnt even see this thread.

      Anyways, a logic if/then currently evaluates things on the fly, but does everything until the end.

      So you are getting a true/false answer then subtracting a value from a boolean which is null/false and so on.
      Fusion Brain Version 6 Released!
      1.9in x 2.9in -- 47mm x 73mm
      30 Digital Outputs -- Directly drive a relay
      15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
      Buy now in the MP3Car.com Store

      Comment


      • #4
        Maybe toss in one more up front that checks for equal to 2.45. That would give the effect of saying => 2.45.
        Thanks,

        Dan

        Comment


        • #5
          Originally posted by 2k1Toaster View Post
          I dont know what's going on with the mp3car forum updates, but I didnt even see this thread.

          Anyways, a logic if/then currently evaluates things on the fly, but does everything until the end.

          So you are getting a true/false answer then subtracting a value from a boolean which is null/false and so on.
          I don't ever get e-mail notifications from this board. As for the logic, I still don't understand. It is working for me now though.

          Originally posted by Dan2008 View Post
          Maybe toss in one more up front that checks for equal to 2.45. That would give the effect of saying => 2.45.
          Tried that. >= check it quit working. A third equal to check broke it as well giving me a flickering result. I did notice whatever function you fiddle with last is moved to the end. The order of the functions can be important.

          Comment

          Working...
          X