-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fec5ad0
Showing
12 changed files
with
929 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script type="text/javascript"> | ||
RED.nodes.registerType('nuimo-config',{ | ||
category: 'config', | ||
defaults: { | ||
name: {value: ""} | ||
} | ||
}); | ||
</script> | ||
|
||
<script type="text/x-red" | ||
data-template-name="nuimo-config"> | ||
<div class="form-row"> | ||
<label><i class="icon-tag"></i> Name</label> | ||
<input type="text" id="node-config-input-name"> | ||
</div> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//Needs to 'hold' the bluetooth connection and expose it to the various 'normal' nodes | ||
|
||
var nuimo = require('../nuimo.js') | ||
|
||
module.exports = function(RED) { | ||
|
||
/*let Nuimo = require('nuimojs'), | ||
nuimo = new Nuimo(); | ||
*/ | ||
function nuimoConfigNode(n) { | ||
RED.nodes.createNode(this,n); | ||
this.nuimo = nuimo; | ||
/* | ||
this.users = []; | ||
this.configNode = n.configNode | ||
this.name = n.name; | ||
var node = this; | ||
nuimo.on("discover", (device) => { | ||
nuimo.on("connect", () => { | ||
node.warn("connected"); | ||
connection = "connected"; | ||
}); | ||
nuimo.on("disconnect", () => { | ||
node.warn("disconnected"); | ||
connection = "disconnected"; | ||
}); | ||
device.connect(); | ||
}); | ||
function writeMatrix(instructions) { | ||
node.warn("Writing matrix"); | ||
nuimo.setLEDMatrix([instructions.matrix], instructions.brightness, instructions.timeout, instructions.options); | ||
} | ||
nuimo.scan();*/ | ||
} | ||
|
||
RED.nodes.registerType("nuimo-config",nuimoConfigNode); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script type="text/javascript"> | ||
RED.nodes.registerType('nuimo-listener', { | ||
category: 'advanced', | ||
color: '#C0C0C0', | ||
defaults: { | ||
name: { value: ""}, | ||
nuimoConfig: {type: "nuimo-config", required:true} | ||
}, | ||
inputs: 0, | ||
outputs: 1, | ||
icon: "apple-touch-icon.png", | ||
label: function() { | ||
return this.name || "Nuimo listener"; | ||
}, | ||
paletteLabel: "Nuimo listener" | ||
}); | ||
</script> | ||
|
||
<script type="text/x-red" data-template-name="nuimo-listener"> | ||
<div class="form-row"> | ||
<label for="node-input-nuimoConfig">Config</label> | ||
<input type="text" id="node-input-nuimoConfig"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-name"><i class="icon-tag"></i> Name</label> | ||
<input type="text" id="node-input-name" placeholder="Name"> | ||
</div> | ||
</script> | ||
|
||
<script type="text/x-red" data-help-name="nuimo-listener"> | ||
<p>A Node-RED node that uses nuimojs and Noble to interact with nuimo devices</p> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//Needs to access the events of Nuimo object | ||
|
||
module.exports = function(RED) { | ||
function nuimoListenerNode(config) { | ||
RED.nodes.createNode(this,config); | ||
this.config = config.nuimoConfig | ||
this.nuimoConfig = RED.nodes.getNode(this.config); | ||
var node = this; | ||
} | ||
RED.nodes.registerType("nuimo-listener",nuimoListenerNode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script type="text/javascript"> | ||
RED.nodes.registerType('nuimo-set-matrix', { | ||
category: 'advanced', | ||
color: '#C0C0C0', | ||
defaults: { | ||
name: { value: "" }, | ||
matrix: {value: "0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0"}, | ||
brightness: { value: 255, validate:RED.validators.number()}, | ||
timeout: { value: 2000, validate:RED.validators.number()}, | ||
onionSkinning: { value: true }, | ||
nuimoConfig: {type:"nuimo-config", required:true} | ||
}, | ||
inputs: 1, | ||
outputs: 1, | ||
icon: "hash.png", | ||
label: function() { | ||
return this.name || "Nuimo matrix"; | ||
}, | ||
paletteLabel: "Nuimo matrix" | ||
}); | ||
</script> | ||
|
||
<script type="text/x-red" data-template-name="nuimo-set-matrix"> | ||
<div class="form-row"> | ||
<label>Config</label> | ||
<input type="text" id="node-input-nuimoConfig"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-name"><i class="icon-tag"></i> Name</label> | ||
<input type="text" id="node-input-name"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-matrix"><i class="icon-tag"></i> Matrix</label> | ||
<input type="text" id="node-input-matrix" placeholder="0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-brightness"><i class="icon-tag"></i> Brightness (0-255)</label> | ||
<input type="text" id="node-input-brightness" placeholder="255"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-timeout"><i class="icon-tag"></i> Timeout</label> | ||
<input type="text" id="node-input-timeout" placeholder="2000"> | ||
</div> | ||
<div class="form-row"> | ||
<label for="node-input-onionSkinning"><i class="icon-tag"></i> Smooth transition</label> | ||
<input type="checkbox" id="node-input-onionSkinning"> | ||
</div> | ||
</script> | ||
|
||
<script type="text/x-red" data-help-name="nuimo-set-matrix"> | ||
<p>A node for creating a matrix to pass through to the Nuimo output node. The matrix value is passed via msg.setMatrix property</p> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//Needs to access the 'writeMatrix' method of Nuimo object | ||
|
||
module.exports = function(RED) { | ||
|
||
function nuimoSetMatrixNode(config) { | ||
RED.nodes.createNode(this,config); | ||
//import the config node | ||
this.nuimoConfig = RED.nodes.getNode(config.nuimoConfig); | ||
|
||
this.matrix = config.matrix; | ||
this.brightness = config.brightness; | ||
this.timeout = config.timeout; | ||
this.onionSkinning = config.onionSkinning; | ||
|
||
var node = this; | ||
this.on('input', function(msg) { | ||
let instructions = { matrix: node.matrix, brightness: node.brightness, timeout: node.timeout, options: {onionSkinning: node.onionSkinning}}; | ||
msg.instructions = instructions; | ||
nuimo.writeMatrix(instructions); | ||
node.send(msg); | ||
}); | ||
} | ||
RED.nodes.registerType("nuimo-set-matrix",nuimoSetMatrixNode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
let Nuimo = require('nuimojs'), | ||
nuimo = new Nuimo(); | ||
|
||
nuimo.on("discover", (device) => { | ||
device.on("connect", () => { | ||
console.log("Nuimo connected"); | ||
}); | ||
device.on("disconnect", () => { | ||
console.log("Nuimo disconnected"); | ||
}); | ||
device.on("press", () => { | ||
console.log("Press"); | ||
}); | ||
function writeMatrix(instructions) { | ||
device.setLEDMatrix([instructions.matrix], instructions.brightness, instructions.timeout, instructions.options); | ||
} | ||
device.connect(); | ||
}); | ||
|
||
nuimo.scan(); | ||
|
||
module.exports.writeMatrix = writeMatrix; |
Oops, something went wrong.