yet more core node info updates

sentiment, gpio, change and range
This commit is contained in:
Dave Conway-Jones 2017-04-26 21:52:33 +01:00
parent 7f90d31846
commit a3c73a04c2
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
6 changed files with 94 additions and 99 deletions

View File

@ -22,11 +22,22 @@
</script>
<script type="text/x-red" data-help-name="sentiment">
<p>Analyses the <code>msg.payload</code> and adds a <code>msg.sentiment</code> object
that contains the resulting AFINN-111 sentiment score as <code>msg.sentiment.score</code>.</p>
<p>Analyses the <code>payload</code> and adds a <code>sentiment</code> object.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>sentiment <span class="property-type">object</span></dt>
<dd>contains the resulting AFINN-111 sentiment.</dd>
<dt>sentiment.score <span class="property-type">number</span></dt>
<dd>the sentiment score.</dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>overrides <span class="property-type">object</span></dt>
<dd>an object of word score overrides can be supplied - <code>{ word:score,... }</code>.</dd>
</dl>
<h3>Details</h3>
<p>A score greater than zero is positive and less than zero is negative.</p>
<p>The score typically ranges from -5 to +5, but can go higher and lower.</p>
<p>An object of word score overrides can be supplied as <code>msg.overrides</code>.</p>
<p>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_blank">the Sentiment docs here</a>.</p>
</script>

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="rpi-gpio in">
<div class="form-row">
@ -66,11 +51,17 @@
<script type="text/x-red" data-help-name="rpi-gpio in">
<p>Raspberry Pi input node. Generates a <code>msg.payload</code> with either a
0 or 1 depending on the state of the input pin.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>the payload will be a 1 or a 0.</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>the topic will be set to `pi/{the pin number}`.</dd>
</dl>
<h3>Details</h3>
<p>You may also enable the input pullup resistor or the pulldown resistor.</p>
<p>The <code>msg.topic</code> is set to <i>pi/{the pin number}</i></p>
<p>Requires the RPi.GPIO python library version 0.5.10 (or better) in order to work.</p>
<p><b>Note:</b> we are using the actual physical pin numbers on connector P1 as they are easier to locate.</p>
</script>
</script>
<script type="text/javascript">
var pinsInUse = {};
@ -208,15 +199,19 @@
<script type="text/x-red" data-help-name="rpi-gpio out">
<p>Raspberry Pi output node. Can be used in Digital, PWM or Servo modes.
<p>Digital mode expects a <code>msg.payload</code> with either a 0 or 1 (or true or false),
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number | string | boolean</span></dt>
</dl>
<h3>Details</h3>
<p>Digital mode - expects a <code>msg.payload</code> with either a 0 or 1 (or true or false),
and will set the selected physical pin high or low depending on the value passed in.</p>
<p>The initial value of the pin at deploy time can also be set to 0 or 1.</p>
<p>When using PWM mode - expects an input value of a number 0 - 100. It can be floating point.</p>
<p>PWM mode - expects an input value of a number 0 - 100. It can be floating point.</p>
<p>PWM mode can be used to drive a servo using input values between 10 and 20 only.
The GPIO2 pin is best for this as it uses hardware to do the PWM.</p>
<p>Setting high PWM frequency might occupy more CPU than expected (default is 100Hz)</p>
The GPIO2 pin is best for this as it uses hardware to do the PWM. For better servo support
consider the alternative node-red-node-pigpio node.</p>
<p>Requires the RPi.GPIO python library version 0.5.10 (or better) in order to work.</p>
<p><b>Note:</b> we are using the actual physical pin numbers on connector P1 as they are easier to locate.</p>
</script>
<script type="text/javascript">
@ -347,12 +342,16 @@
<script type="text/x-red" data-help-name="rpi-mouse">
<p>Raspberry Pi mouse button node. Requires a USB mouse.</p>
<p>Generates a <code>msg.payload</code> with
either a 1 or 0 when the selected mouse button is pressed and released</p>
<p>Also sets <code>msg.button</code> to the code value
<ul><li>1 = left</li><li>2 = right</li><li>4 = middle</li></ul>
so you can work out which button or combination was pressed.</p>
<p>And sets <code>msg.topic</code> to <i>pi/mouse</i>.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>1 or 0 when the selected mouse button is pressed and released.</dd>
<dt>button <span class="property-type">number</span></dt>
<dd>1, 2, 4 corresponding to left, right and middle buttons, so you
can work out which button or combination was pressed.</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>set to <code>pi/mouse</code></dd>
</dl>
</script>
<script type="text/javascript">
@ -388,9 +387,15 @@
<script type="text/x-red" data-help-name="rpi-keyboard">
<p>Raspberry Pi keyboard handling node. Requires a USB keyboard.</p>
<p>Generates a <code>msg.payload</code> with a keycode, and <code>msg.action</code> set to
<i>up, down</i> or <i>repeat</i> whenever a key is pressed or released.</p>
<p>It also sets <code>msg.topic</code> to <i>pi/key</i>.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>contains the keycode value</dd>
<dt>action <span class="property-type">string</span></dt>
<dd>set to "up", "down", or "repeat"</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>set to <code>pi/key</code></dd>
</dl>
</script>
<script type="text/javascript">

View File

@ -1,18 +1,3 @@
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
module.exports = function(RED) {
"use strict";

View File

@ -270,7 +270,7 @@
"title": "Title",
"body": "Body"
},
"tip": "Tip: The text can be styled as <a href=\"https://help.github.com/articles/markdown-basics/\" target=\"_blank\">Github flavoured Markdown</a>"
"tip": "Tip: The body text can be styled as <a href=\"https://help.github.com/articles/markdown-basics/\" target=\"_blank\">Github flavoured Markdown</a>"
},
"unknown": {
"label": {
@ -664,8 +664,7 @@
"pikeyboard": "Pi Keyboard",
"left": "Left",
"right": "Right",
"middle": "Middle",
"freq": "Frequency (Hz)"
"middle": "Middle"
},
"resistor": {
"none": "none",
@ -674,6 +673,7 @@
},
"digout": "Digital output",
"pwmout": "PWM output",
"servo": "Servo output",
"initpin0": "initial level of pin - low (0)",
"initpin1": "initial level of pin - high (1)",
"left": "left",
@ -687,14 +687,16 @@
"pin": "<b>Pins in Use</b>: ",
"in": "Tip: Only Digital Input is supported - input must be 0 or 1.",
"dig": "Tip: For digital output - input must be 0 or 1.",
"pwm": "Tip: For PWM output - input must be between 0 to 100; setting high frequency might occupy more CPU than expected."
"pwm": "Tip: For PWM output - input must be between 0 to 100; setting high frequency might occupy more CPU than expected.",
"ser": "<b>Tip</b>: For Servo output - input must be between 0 to 100. 50 is centre."
},
"types": {
"digout": "digital output",
"input": "input",
"pullup": "input with pull up",
"pulldown": "input with pull down",
"pwmout": "PWM output"
"pwmout": "PWM output",
"servo": "Servo output"
},
"status": {
"stopped": "stopped",

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="change">
<div class="form-row">
@ -30,17 +15,26 @@
<script type="text/x-red" data-help-name="change">
<p>Set, change, delete or move properties of a message, flow context or global context.</p>
<p>The node can specify multiple rules that will be applied in turn.</p>
<h3>Options</h3>
<p>The available operations are:</p>
<ul>
<li><b>Set</b> - set a property. The value can be a variety of different types, or
can be taken from an existing message or context property.</li>
<li><b>Change</b> - search &amp; replace parts of the property. If regular expressions
are enabled, the <b>replace with</b> property can include capture groups, for
example <code>$1</code>. Replace will only change the <b>type</b> if there
is a complete match.</li>
<li><b>Delete</b> - delete a property.</li>
<li><b>Move</b> - move or rename a property.</li>
</ul>
<dl class="message-properties">
<dt>Set</dt>
<dd>set a property. The value can be a variety of different types, or
can be taken from an existing message or context property.</dd>
<dt>Change</dt>
<dd>search &amp; replace parts of the property. If regular expressions
are enabled, the "replace with" property can include capture groups, for
example <code>$1</code>. Replace will only change the type if there
is a complete match.</dd>
<dt>Delete</dt>
<dd>delete a property.</dd>
<dt>Move</dt>
<dd>move or rename a property.</dt>
</dl>
<h3>Details</h3>
<p>The "expression" option uses the <a href="http://jsonata.org/" target="_new">JSONata</a>
query and expression language. You can paste your data into <a href="http://try.jsonata.org/" target="_new">this site it</a>
to experiment and then use the expression back here.</p>
</script>
<script type="text/javascript">
@ -224,7 +218,7 @@
t:(this.action=="replace"?"set":this.action),
p:this.property,
pt:"msg"
}
};
if ((rule.t === "set")||(rule.t === "move")) {
rule.to = this.to;

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="range">
<div class="form-row">
@ -49,10 +34,23 @@
<script type="text/x-red" data-help-name="range">
<p>A simple function node to remap numeric input values to another scale.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>the input payload <i>must</i> be a number. Anything else will try to be
parsed into a number and rejected if that fails.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>the output payload will always be a numeric type..</dd>
</dl>
<h3>Details</h3>
<p>Currently only does a linear scaling.</p>
<p><b>Note:</b> This only operates on <b>numbers</b>. Anything else will try to be made into a number and rejected if that fails.</p>
<p><i>Scale and limit to target range</i> means that the result will never be outside the range specified within the result range.</p>
<p><i>Scale and wrap within the target range</i> means that the result will essentially be a "modulo-style" wrap-around within the result range.</p>
<p><i>Scale and limit to target range</i> means that the result will never be outside
the range specified within the result range.</p>
<p><i>Scale and wrap within the target range</i> means that the result will
be a "modulo-style" wrap-around within the result range.</p>
</script>
<script type="text/javascript">