Giter Club home page Giter Club logo

svd-xbee's Introduction

A more high level fork of Richard Morrison's node-xbee.

Example

If you pass no parser function to the XBee() constructor, nodes will emit each data packet that they receive as a 'data' event. See simple-parser.js for a basic parser that splits on \r, and is easily adapted if you wish to use \n or some other delimiter. The simple parser will merge frames and emit them split by your delimiter (so if you wonder why no data is emitted, make sure you use the right delimiter!).

Set things up like this, substituting in paramaters that match your Xbee network:

var util = require('util');
var XBee = require('svd-xbee').XBee;

// Replace with your xbee's UART location and correct baud rate (if you omit baudrate, the code assumes your xbee talks at 57600).
var xbee = new XBee({port: '/dev/tty01', baudrate:9600});

xbee.on("configured", function(config) {
  console.log("XBee Config: %s", util.inspect(config));
});

xbee.on("node", function(node) {
  console.log("Node %s connected", node.id);

  node.on("data", function(data) {
    console.log("%s: %s", node.id, util.inspect(data));
  });

});

Then, you can run:

xbee.init();

and you should start to see things logged back to your console.

Background

Note that this readme is still mostly copied from the original module!

Digi's xbee modules are good for quickly building low power wireless networks.

They can be connected to a computer over RS232 and communicated on using a standard serial port.

Even easier, with something like the XBee USB Explorer by SparkFun, you can connect to them easily over USB.

This work is inspired by:

Setup

I have my xbee coordinator radio connected to the computer running Node. Crucially, the coordinator is in xbee's API mode 2 - this is required to allow you to send remote instructions, and so on, and uses escaping to improve reliability.

My remote xbee network modules send periodic measurements and I can push them to web browsers, save them in a database, etc.

I can also use this library to send remote commands and query remote xbee modules. For instance, setting a digital output on a remote module could turn a light on, or a motor, or a laser beam - up to you!

Installation

npm install svd-xbee

Licence

This work is based on the works of Richard Morrison Creative Commons License
This work by Richard Morrison is licensed under a Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales License.
Based on a work at github.com.

svd-xbee's People

Contributors

jankolkmeier avatar legege avatar mozz100 avatar msealand avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.