Created
April 7, 2014 20:20
-
-
Save bigkevmcd/10044564 to your computer and use it in GitHub Desktop.
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 characters
| var rfxcom = require('./lib'); | |
| var rfxtrx = new rfxcom.RfxCom("/dev/tty.usbserial-05VLOAQQ", {debug: true}); | |
| rfxtrx.on("receive", function(data) { | |
| console.log(data); | |
| }); | |
| rfxtrx.on("elec2", function(evt) { | |
| console.log(evt); | |
| }); | |
| rfxtrx.on("status", function (evt) { | |
| console.log("Status message"); | |
| console.log("Subtype: " + evt.subtype); | |
| console.log("Sequence number: " + evt.seqnbr); | |
| console.log("Command: " + evt.cmnd); | |
| console.log("Receiver Type: " + evt.receiverType); | |
| console.log("Firmware Version: " + evt.firmwareVersion); | |
| console.log("Enabled Protocols:"); | |
| for (var n = 0; n < evt.enabledProtocols.length; n++) { | |
| console.log(" " + evt.enabledProtocols[n]); | |
| } | |
| console.log(""); | |
| }); | |
| rfxtrx.initialise(function (error) { | |
| if (error) { | |
| throw new Error("Unable to initialise the rfx device"); | |
| } else { | |
| console.log("Device initialised"); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works for me !