Git Product home page Git Product logo

raspihats_nodejs's Introduction

raspihats

Node.js package for interfacing Raspberry Pi add-on boards located at raspihats.com

Installation

$ npm install raspihats --save

I2C clock stretch timeout

It's important for the I2C clock stretch timeout to have the right value before issuing requests to a I2C-HAT, cd to 'node_modules/raspihats' and run the following command to set the right clock stretch timeout:

$ sudo npm run i2c_clks_timeout

I2C-HAT usage example

var raspihats = require('raspihats');
var DI6acDQ6rly = raspihats.i2cHats.DI6acDQ6rly;

var b = new DI6acDQ6rly(0x60);

// All the following methods will issue a request and get a response from the board over the I2C bus.
b.getName();                // reads board name
b.getFirmwareVersion();     // reads firmware version
//b.reset();                  // resets the board, wait at least 1ms after reset before issuing another request
b.getStatus();              // reads status word, bits [0: power on reset, 1: software reset, 2: watchdog reset]

// Digital Inputs
b.DI.getValue();            // read all digital input channels
b.DI.getChannel(0);         // read single digital input channel

// Digital Outputs
b.DQ.setValue(0x02);        // write all digital output channels
b.DQ.setChannel(0, true);   // write single digital output channel

b.DQ.getValue();            // read all digital output channels
b.DQ.getChannel(0);         // read single digital output channel

Release History

  • 1.0.0 Initial release

    Supported functionality:

    • Basic(read board name, read firmware version, read status word, reset)
    • Communication WatchDog(read/write period)
    • Digital Inputs(read value, read channel, read channel counter, reset channel counter)
    • Digital Outputs(read/write value, read/write channel, read/write PowerOnValue, read/write SafetyValue)

    Supported boards:

  • 1.1.0 Added DQ8rly

    Added boards:

  • 1.1.1 Small fix

    Modified exception message thrown if an unexpected board is found at the desired address.

  • 1.1.2 Updated i2c-bus dependency version and small fix

    Now using [email protected], and using Buffer.alloc instead of new Buffer.

License

MIT

raspihats_nodejs's People

Contributors

florincosta avatar

Watchers

James Cloos avatar  avatar

raspihats_nodejs's Issues

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.