UNPKG

node-red-contrib-ledmatrix

Version:

Contains the nodes used in TimeSquAir to use the LEDMatrix library

38 lines (30 loc) 1 kB
/** Copyright © 2015 Digital Airways (www.DigitalAirways.com) This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net for more details. **/ module.exports = function(RED) { "use strict"; var Mustache = require("mustache"); var CMD = "rm -f {{{dest}}} 2>> {{{log}}};\n"; function ledblank(n) { RED.nodes.createNode(this,n); this.text = n.text; var node = this; this.on('input', function (msg) { var params = { dest: "{{{finalppm}}}", log: "/root/userdir/ledmatrix/log.txt" } var cmd = Mustache.render(CMD, params); if(typeof msg.cmd != "string") { msg.cmd = ""; } msg.cmd += cmd; node.send(msg); }); } RED.nodes.registerType("ledblank", ledblank); }