Giter VIP home page Giter VIP logo

node-ds2482-io's Introduction

DS2413 Onewire IO Module

![Gitter](https://badges.gitter.im/Join Chat.svg)

Provides an interface for Dallas DS2413 IO modules over the DS2482 onewire bridge

Install

$ npm install ds2482-io

Usage

var DS2413 = require('ds2482-io');

var io = new DS2413();

io.init(function(err) {
  if (err) { throw err; }
  
  io.search(function(err, modules) {
    if (err) { throw err; }
    
    modules.forEach(function(module) {
      module.write({PIOA: true}, function(err, resp) {
        if (err) { throw err; }
        
        console.log(resp); // Returns the status of each module
      });
    });
  });
});

API

new DS2413([options])

Creates an interface for Dallas DS2413 IO modules

  • options.wire an instance of wire

new DS2413.Module(rom [, options])

Creates an io module instance

  • rom the ROM address of the module as a 16 character hex encoded string
  • options.wire an instance of wire

io.init(callback)

Resets the bridge chip and any onewire devices connected to it

io.search(callback)

Searches the bus and returns a list of found io modules

[
  <Module "3ae9f412000000a6">
]

module.read(callback)

Reads the current pin and latch state status of the module

{
  PIOA: {pin: false, latch: false},
  PIOB: {pin: false, latch: false}
}

module.write(state, callback)

Writes the latch state to the module and returns the current status

  • state.PIOA a flag to enable the output latch state of pin A
  • state.PIOB a flag to enable the output latch state of pin B
{
  PIOA: {pin: true, latch: true},
  PIOB: {pin: false, latch: false}
}

node-ds2482-io's People

Contributors

ianmetcalf avatar

Watchers

 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.