This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Function Node Code to correct non-linear sensor ?
#3
(2018-02-25, 11:23 PM)affinite Wrote: I think that what I really need is some JSON code for a NodeRed function node that will take a raw ADC value range and convert it into a value in litres. 
...
I have no clue how to write JSON code so Im hoping that someone may have addressed this issue before.

JSON is a data format! https://en.wikipedia.org/wiki/JSON
Please read and understand.


After that open node red in the browser and scroll down in the list of nodes. You may stumble upon the range node.

I quote node red:
Quote:A simple function node to remap numeric input values to another scale.

Currently only does a linear scaling.

Note: This only operates on numbers. Anything else will try to be made into a number and rejected if that fails.
Scale and limit to target range means that the result will never be outside the range specified within the result range.
Scale and wrap within the target range means that the result will essentially be a "modulo-style" wrap-around within the result range.

Add the range node to your flow and set the input range to 0 - 1024 and the result range to 0 - 320.
et voilà
Reply


Messages In This Thread
RE: Function Node Code to correct non-linear sensor ? - by shark24 - 2018-02-26, 01:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)