1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Update README list to add smooth node to function category.

tweak Sample node to be inline with core sample node.
This commit is contained in:
Dave C-J 2014-09-21 11:17:49 +01:00
parent 410ef92166
commit dc7da9680b
3 changed files with 16 additions and 5 deletions

View File

@ -65,7 +65,7 @@
name: {value:""}, // along with default values. name: {value:""}, // along with default values.
topic: {value:"", required:true} topic: {value:"", required:true}
}, },
inputs:0, // set the number of inputs - only 0 or 1 inputs:1, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n outputs:1, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node) // set the icon (held in icons dir below where you save the node)
icon: "myicon.png", // saved in icons/myicon.png icon: "myicon.png", // saved in icons/myicon.png

View File

@ -21,6 +21,8 @@
// Require main module // Require main module
module.exports = function(RED) { module.exports = function(RED) {
"use strict"; "use strict";
// require any external libraries we may need....
//var foo = require("foo-library");
// The main node definition - most things happen in here // The main node definition - most things happen in here
function SampleNode(n) { function SampleNode(n) {
@ -41,6 +43,13 @@ module.exports = function(RED) {
// send out the message to the rest of the workspace. // send out the message to the rest of the workspace.
this.send(msg); this.send(msg);
// respond to inputs....
this.on('input', function (msg) {
node.warn("I saw a payload: "+msg.payload);
// in this example just send it straight on... should process it here really
this.send(msg);
}
this.on("close", function() { this.on("close", function() {
// Called when the node is shutdown - eg on redeploy. // Called when the node is shutdown - eg on redeploy.
// Allows ports to be closed, connections dropped etc. // Allows ports to be closed, connections dropped etc.

View File

@ -4,9 +4,9 @@ A collection of nodes for [Node-RED](http://nodered.org). See below for a list.
## Installation ## Installation
Many of these nodes are available as an npm package. See the respective README.md for the npm package name. Many of these nodes are available as an npm package. See the respective README.md for the npm package name.
To manually install using this repo: To manually install using this repo:
1. cd into the `nodes` directory of Node-RED 1. cd into the `nodes` directory of Node-RED
2. Either: 2. Either:
@ -49,12 +49,14 @@ Copyright 2013 IBM Corp. under [the Apache 2.0 license](LICENSE).
### Analysis ### Analysis
**[17-smooth](analysis/smooth)** - A simple node to provide various functions across several previous values, including max, min, mean, high and low pass filters.
**[72-wordpos](analysis/wordpos)** - Analyses the payload and classifies the part-of-speech of each word. The resulting message has msg.pos added with the results. A word may appear in multiple categories (eg, 'great' is both a noun and an adjective). **[72-wordpos](analysis/wordpos)** - Analyses the payload and classifies the part-of-speech of each word. The resulting message has msg.pos added with the results. A word may appear in multiple categories (eg, 'great' is both a noun and an adjective).
**[74-swearfilter](analysis/swearfilter)** - Analyses the payload and tries to filter out any messages containing bad swear words. This only operates on payloads of type string. Everything else is blocked. **[74-swearfilter](analysis/swearfilter)** - Analyses the payload and tries to filter out any messages containing bad swear words. This only operates on payloads of type string. Everything else is blocked.
### Function
**[17-smooth](analysis/smooth)** - A simple node to provide various functions across several previous values, including max, min, mean, high and low pass filters.
### Hardware ### Hardware
**[37-rpi-piface](hardware/PiFace)** - Adds support for the [PiFace](http://www.piface.org.uk/) interface module for Raspberry Pi. **[37-rpi-piface](hardware/PiFace)** - Adds support for the [PiFace](http://www.piface.org.uk/) interface module for Raspberry Pi.