add readme and license info

This commit is contained in:
Todd Treece 2016-05-19 10:40:32 -04:00
parent 3b5264cfbd
commit 783385becc
2 changed files with 57 additions and 0 deletions

22
LICENSE Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 Adafruit Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

35
README.md Normal file
View file

@ -0,0 +1,35 @@
# MPR121 Library for Node.js
This library allows you to access a MPR121 breakout using Node.js from a Raspberry Pi or BeagleBone Black.
## Installation
This library requires Node.js v6.0.0 or higher.
```sh
$ npm install mpr121
```
## Example
```js
const MPR121 = require('mpr121'),
mpr121 = new MPR121(0x5A, 1);
// listen for touch events
mpr121.on('touch', (pin) => console.log(`pin ${pin} touched`));
// listen for release events
mpr121.on('release', (pin) => console.log(`pin ${pin} released`));
// listen for changes to the state of a specific pin
mpr121.on(3, (state) => console.log(`pin 3 is ${state ? 'touched' : 'released'}`);
// check the current state of a specific pin synchronously
const state = mpr121.isTouched(2);
console.log(`pin 2 is ${state ? 'touched' : 'released'}`);
```
## License
Copyright (c) 2016 Adafruit Industries. Licensed under the MIT license.