Giter VIP home page Giter VIP logo

clj-xbee's Introduction

clj-xbee

Build Status Clojars Project Tag Clojure version

Clojure Wrapper for Digi's Official XBee Java Library

Contents

  • Dependencies
  • Setup
  • Usage
  • Resources
  • License

Dependencies

You will need to install the native rxtx serial library. We have not found a consistently good developer experience for this on modern Macs, so we are recommending that developers use Linux for this.

For example, with Debian-based systems, to install both rxtx and rxtx-native, you just need to do this:

$ sudo apt-get install librxtx-java

In order to access the serial port as non-root, you will need to add yourself to the group that owns the device. On Ubuntu, this is the dialout group:

$ sudo usermod -a -G dialout `whoami`

Setup

Once your XBee radio is plugged in, you can find the device file by doing the following:

$ dmesg

and looking for the recent line that comes up mentioning a USB serial device; the message will also give the relative device path, e.g.:

[518497.515732] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0

You can confirm that this is the correct device by this:

$ udevadm info -q all /dev/ttyUSB0

Note that the device info you'll be seeing is for the USB Serial-to-USB converter, i.e., the "XBee Explorer" -- not the XBee radio itself.

Usage

To get started, your project will need to include the dependency. For lein:

[systems.billo/clj-xbee "0.2.0-SNAPSHOT"]

Then, in your ns setup, require the following:

[xbee.device.core :as xbee]

Create and open a device:

[xbee.dev] λ=> (def d (xbee/create-device :raw802 "/dev/ttyUSB0" 9600))
#'xbee.dev/d
[xbee.dev] λ=> (xbee/open d)
nil

Note that the passed device type will depend upon what type of radio you have. If we haven't wrapped the Java API for your particular XBee radio, just submit a new ticket and we'll get that done for you.

If you get warnings about minor version mismatches, you can disregard.

Update the device info cache:

[xbee.dev] λ=> (xbee/read-device-info d)
nil

Get some basic device info:

[xbee.dev] λ=> (xbee/get-firmware-version d)
"10EF"
[xbee.dev] λ=> (xbee/get-hardware-version d)
24
[xbee.dev] λ=> (xbee/get-power-level d)
{:id 4, :name "Highest"}
[xbee.dev] λ=> (xbee/get-xbee-protocol d)
{:id 1, :name "802.15.4"}
[xbee.dev] λ=> (xbee/get-64bit-addr d)
"00000000-00000000-A20040FF-FFD692BD"

Resources

License

Copyright © 2017, Billo Systems, Ltd. Co.

Copyright © 2017, Duncan McGreggor

Distributed under the Apache License Version 2.0.

clj-xbee's People

Contributors

bjorstrom avatar oubiwann avatar

Stargazers

STYLIANOS IORDANIS avatar Eric Bailey avatar  avatar  avatar

Watchers

James Cloos avatar  avatar Bill T. Ota avatar  avatar  avatar

clj-xbee's Issues

Platform recommendation

I've tried developing against the XBee on both Linux and Mac; it used to be the XBee Mac dev (in 2014/2015) was fairly straight-forward and easy to support ... maybe even easier than Linux dev. This doesn't seem to be the case anymore. I have found getting set up in Linux was trivially easy in 2017; on the Mac (due to the rxtx lib) it was fraught with issues.

It might be a good idea to focus on Linux dev for now and make that a recommendation for users; any contribs from hard-core Mac devs would, of course, be super-cool ;-)

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.