big-red-button

    0.0.11 • Public • Published

    Big Red Button

    A node-hid based driver to read actions from the Dream Cheeky Big Red Button.

    Credit

    This was initially a fork of BigRedButtonNodeHID by Dj Walker-Morgan.

    Install

    npm install big-red-button

    Usage

    var BigRedButton = require('big-red-button');
     
    var bigRedButtons = [];
     
    for (var i = 0; i < BigRedButton.deviceCount(); i++) {
      console.log('opening BigRedButton', i);
     
      bigRedButtons.push(new BigRedButton.BigRedButton(i));
     
      bigRedButtons[i].on('buttonPressed', function () {
        console.log('Button pressed');
      });
     
      bigRedButtons[i].on('buttonReleased', function () {
        console.log('Button released');
      });
     
      bigRedButtons[i].on('lidRaised', function () {
        console.log('Lid raised');
      });
     
      bigRedButtons[i].on('lidClosed', function () {
        console.log('Lid closed');
      });
     
      bigRedButtons[i].on('error', function (error) {
        console.error(error);
      });
    }

    Events

    • lidRaised

    • lidClosed

    • buttonPressed

    • buttonReleased

    • error

    State methods

    • button.isLidUp()

    • button.isLidDown()

    • button.isButtonPressed()

    FAQ

    • Q. It's not working on linux!

      • A. On linux, you may need to run as root for it to work. You can try setting a rule for non-root users to access the device.

        Create the rule file:

        sudo vim /etc/udev/rules.d/100-bigred.rules

        and add the following:

        SUBSYSTEM=="input", GROUP="input", MODE="0666"
        SUBSYSTEM=="usb", ATTRS{idVendor}=="7476", ATTRS{idProduct}=="13", MODE:="666", GROUP="plugdev"

        Afterwards, you can reload the service:

        sudo udevadm control --reload-rules

        More info on the node-hid repo.

    • Q. What's the vendor ID and product ID?

      • A. The vendor ID is 7476. The product ID is 13.

    License

    MIT

    Install

    npm i big-red-button

    DownloadsWeekly Downloads

    28

    Version

    0.0.11

    License

    MIT

    Unpacked Size

    50.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • miguelmota