From dc7da9680b6cafd84761c262415f092282df95e2 Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Sun, 21 Sep 2014 11:17:49 +0100 Subject: [PATCH] Update README list to add smooth node to function category. tweak Sample node to be inline with core sample node. --- 99-sample.html.demo | 2 +- 99-sample.js.demo | 9 +++++++++ README.md | 10 ++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/99-sample.html.demo b/99-sample.html.demo index fbc733d2..06092b03 100644 --- a/99-sample.html.demo +++ b/99-sample.html.demo @@ -65,7 +65,7 @@ name: {value:""}, // along with default values. 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 // set the icon (held in icons dir below where you save the node) icon: "myicon.png", // saved in icons/myicon.png diff --git a/99-sample.js.demo b/99-sample.js.demo index 0bba1818..5147e092 100644 --- a/99-sample.js.demo +++ b/99-sample.js.demo @@ -21,6 +21,8 @@ // Require main module module.exports = function(RED) { "use strict"; + // require any external libraries we may need.... + //var foo = require("foo-library"); // The main node definition - most things happen in here function SampleNode(n) { @@ -41,6 +43,13 @@ module.exports = function(RED) { // send out the message to the rest of the workspace. 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() { // Called when the node is shutdown - eg on redeploy. // Allows ports to be closed, connections dropped etc. diff --git a/README.md b/README.md index afb844fd..d8981285 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ A collection of nodes for [Node-RED](http://nodered.org). See below for a list. ## 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 2. Either: @@ -49,12 +49,14 @@ Copyright 2013 IBM Corp. under [the Apache 2.0 license](LICENSE). ### 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). **[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 **[37-rpi-piface](hardware/PiFace)** - Adds support for the [PiFace](http://www.piface.org.uk/) interface module for Raspberry Pi.