Revisions
-
AppLamp-API revised this gist
Mar 31, 2014 . No changes.There are no files selected for viewing
-
AppLamp-API revised this gist
Mar 31, 2014 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,13 @@ //send a command ( see commands.js ) box.command(cmd.rgbw.hue(180)); box.command(cmd.white.allOn()); TIP: You don't need to know the exact IP of your Wifi Box. If you know your DHCP IP range, just replace the last digit to .255 That way you wil perform a UDP multicast and the wifi box will receive it. So for example your network range is 192.168.1.1 to 192.18.1.254, then use 192.18.1.255 to perform a multicast. **/ var http = require('http'); -
AppLamp-API revised this gist
Mar 31, 2014 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,28 @@ /** Filename: wifibox.js //AppLamp.nl Wifi LED light API: wifi box UDP socket, command sender © AppLamp.nl: you can share,modify and use this code (commercially) as long as you keep the referer "AppLamp.nl led light API" in the file header. Usage in Node JS: //load this wifi box class var WifiBoxModule = require('wifibox.js'); var cmd = require('commands.js'); //create instance with wifi box ip and port var box = new WifiBoxModule("192.168.1.255", 8899); //send a command ( see commands.js ) box.command(cmd.rgbw.hue(180)); box.command(cmd.white.allOn()); **/ var http = require('http'); var dgram = require('dgram'); var WifiBox = function (ip, port) { this.client = dgram.createSocket('udp4'); const default_ip = '192.168.1.255'; const default_port = 8899; this.ip = (ip != undefined && ip.length > 6) ? ip : default_ip; this.port = (port != undefined && port > 0) ? port : default_port; -
AppLamp-API revised this gist
Mar 31, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ var WifiBoxModule = require('wifibox.js'); var byteCommand = require('commands.js'); //create instance with wifi box ip and port var box = new WifiBoxModule("192.168.1.255", 8899); //send a command ( see commands.js ) box.command(byteCommand.bulb.color.hue(180)); box.command(byteCommand.bulb.white.allOn()); -
AppLamp-API renamed this gist
May 14, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
AppLamp-API created this gist
May 14, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ /** Filename: wifibox.js //AppLamp.nl led light API: wifi box UDP socket, command sender © AppLamp.nl: you can share,modify and use this code (commercially) as long as you keep the referer "AppLamp.nl led light API" in the file header. Usage in Node JS: //load this wifi box class var WifiBoxModule = require('wifibox.js'); var byteCommand = require('commands.js'); //create instance with wifi box ip and port var box = new WifiBoxModule("192.168.1.100", 50000); //send a command ( see commands.js ) box.command(byteCommand.bulb.color.hue(180)); box.command(byteCommand.bulb.white.allOn()); **/ var http = require('http'); var dgram = require('dgram'); var WifiBox = function (ip, port) { this.client = dgram.createSocket('udp4'); const default_ip = '192.168.1.100'; const default_port = 50000; this.ip = (ip != undefined && ip.length > 6) ? ip : default_ip; this.port = (port != undefined && port > 0) ? port : default_port; }; WifiBox.prototype.command = function (threeByteArray) { var buffer = new Buffer(threeByteArray); this.client.send(buffer , 0 , buffer.length , this.port , this.ip , function (err, bytes) { if (err) { console.log("udp error:" + err); throw err; } else { console.log('bytes send: ' + [threeByteArray[0], threeByteArray[1], threeByteArray[2]]) } } ); } WifiBox.prototype.toString = function () { return 'WifiBox: { ip:' + this.ip + ':' + this.port + '}'; }; module.exports = WifiBox;