Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ezeio2:scriptref:getinputvalue [2019-06-16 00:50] – created andreh | ezeio2:scriptref:getinputvalue [2019-09-02 21:38] (current) – andreh | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Script reference ====== | + | ==== GetInputValue ==== |
- | + | ||
- | ==== GetInputValue( inputno, mode ) ==== | + | |
Fetch the value of a hardware input. | Fetch the value of a hardware input. | ||
Line 15: | Line 13: | ||
| '' | | '' | ||
| '' | | '' | ||
+ | |||
+ | Input numbers: | ||
+ | ^ Input ^ Description ^ | ||
+ | ^ IN_1 .. IN_16 | Input numbers (equivalent to 1 .. 16) | | ||
+ | ^ IN_VIN | Supply voltage (in mV) | | ||
+ | ^ IN_VBAT | Voltage on Battery Terminals (in mV) | | ||
+ | ^ IN_V5 | 5V regulated output voltage | | ||
+ | ^ DVC1+IN_1 | (example) First input on first expansion device | | ||
+ | |||
Available read modes: | Available read modes: | ||
^ Mode ^ Reading ^ | ^ Mode ^ Reading ^ | ||
^ INVAL_RAW | Momentary value. Unit depends on input hardware setting. | | ^ INVAL_RAW | Momentary value. Unit depends on input hardware setting. | | ||
- | ^ INVAL_INTERVAL | Pulse interval in mHz | | + | ^ INVAL_MIN | Smallest value in this sampling interval. Unit depends on input hardware setting. | |
+ | ^ INVAL_MAX | Largest value in this sampling interval. | ||
+ | ^ INVAL_AVG | Average value in this sampling interval. Unit depends on input hardware setting. | | ||
+ | ^ INVAL_INTERVAL | Pulse interval in ms | | ||
+ | ^ INVAL_FREQ | Pulse frequency in Hz x1000 (mHz) | | ||
^ INVAL_COUNT | Pulse count | | ^ INVAL_COUNT | Pulse count | | ||
=== Return value === | === Return value === | ||
- | Value of input | + | Value of input. |
+ | |||
+ | The unit of the returned value depends on the input hardware setting: | ||
+ | ^ Hardware setting ^ Input unit ^ Description ^ | ||
+ | | INMODE_10V | mV (milliVolt) | 0-10240 mV | | ||
+ | | INMODE_30mA | uA (microAmpere) | 0-30000 uA | | ||
+ | | INMODE_PULLUP | Ω (Ohm) | 0-10000000 Ohm (0-1MΩ) | | ||
+ | | INMODE_THERMISTOR* | °K x100 (Kelvin) | 0-60000 Kelvin x 100 | | ||
=== Example usage === | === Example usage === | ||
Line 30: | Line 48: | ||
<code javascript> | <code javascript> | ||
new x; | new x; | ||
- | x = GetInputValue(3, INVAL_RAW); | + | x = GetInputValue(IN_3, INVAL_RAW); |
</ | </ | ||