Module for the MPR121 12-Channel Capacitive Sensor (I2C)

Use the MPR121 (About Modules) module for reading which of the MPR121's 12 electrodes are touched

This module communicates with the chip over I2C.

Basic usage

I2C1.setup({scl:B6,sda:B7});

function ready() {
    setTimeout(function() {
        var keys = mpr.touched();
        console.log("Touched: " + keys);
    }, 200);
}

var mpr = require("MPR121").connect(I2C1, ready);
// or
var mpr = require("MPR121").connect(I2C1, ready, { address: 0x5B });

MPR121 module functions

  • touched() - gives back a 12bit number where each high bit is an activated electrode/key

  • setThresholds() - sets the press/release treshold values

  • write(data) - writes the provided data (array) to the i2c bus

  • read(count) - reads the given number of bytes from the i2c bus

  • readWord(reg) - read a 16 bit value from the given register address

  • readByte(reg) - read an 8 bit value from the given register address

  • filteredData(pin) - return the 16 bit 'filtered' capacitance data for this pin

  • baselineData(pin) - return the 'baseline' capacitance data (0..1023) for this pin

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.