npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-picap

v1.1.0

Published

Node module for interfacing with the MPR121 on the [Bare Conductive Pi Cap](https://www.bareconductive.com/shop/pi-cap/).

Downloads

4

Readme

node-picap

Node module for interfacing with the MPR121 on the Bare Conductive Pi Cap.

Bare Conductive

Installation

This library requires Node.js v6.7.0 or higher and also requires that the Bare Conductive MPR121 Wiring Pi Library be installed.

If you're using a Raspberry Pi, this is most easily achieved by running

sudo apt-get install picap

which will install this module along with lots of example code and setup utilities that will help you get the most out of your Pi Cap.

If you're a masochist, start with

npm install node-picap

Usage

Simple Touch example

var MPR121 = require('node-picap');
var mpr121;

// correct address for the Pi Cap - other boards may vary
mpr121 = new MPR121('0x5C');

mpr121.on('data', function(data) {
  data.forEach(function(electrode, i) {
    if (electrode.isNewTouch) {
      console.log('electrode ' + i + ' was just touched');
    }
    else if (electrode.isNewRelease) {
      console.log('electrode ' + i + ' was just released');
    }
  });
});

Datastream example

var MPR121 = require('node-picap');
var mpr121;

// note that interval sets the interval (in ms) at which 
// the module attempts to emit data events - the MPR121 
// hardware sets a lower limit on this - default is 10ms, 
// can set down to 1ms
mpr121 = new MPR121('0x5C', { interval: 10 });

mpr121.on('data', function(data) {
  // split out each of the various data streams...
  var touch = data.map(function(electrode) { return electrode.isTouched ? 1 : 0; });
  var tths  = data.map(function(electrode) { return electrode.touchThreshold; });
  var rths  = data.map(function(electrode) { return electrode.releaseThreshold; });
  var fdat  = data.map(function(electrode) { return electrode.filtered; });
  var bval  = data.map(function(electrode) { return electrode.baseline; });
  var diff  = data.map(function(electrode) { return electrode.baseline - electrode.filtered; });

  // ...and send them out via stdout - simples!
  console.log('TOUCH: ' + touch.join(' '));
  console.log('TTHS: ' + tths.join(' '));
  console.log('RTHS: ' + rths.join(' '));
  console.log('FDAT: ' + fdat.join(' '));
  console.log('BVAL: ' + bval.join(' '));
  console.log('DIFF: ' + diff.join(' '));
});

License

This work is licensed under a MIT license

Copyright (c) 2016-2017, Bare Conductive