nanoFramework.Iot.Device.Mpr121 1.2.737

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Mpr121 --version 1.2.737
                    
NuGet\Install-Package nanoFramework.Iot.Device.Mpr121 -Version 1.2.737
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Mpr121" Version="1.2.737" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Mpr121" Version="1.2.737" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Mpr121" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Mpr121 --version 1.2.737
                    
#r "nuget: nanoFramework.Iot.Device.Mpr121, 1.2.737"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Mpr121@1.2.737
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Mpr121&version=1.2.737
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Mpr121&version=1.2.737
                    
Install as a Cake Tool

MPR121 - Proximity Capacitive Touch Sensor Controller

The 12-channels I2C proximity capacitive touch sensor controller.

Documentation

Usage

Important: make sure you properly setup the I2C pins especially for ESP32 before creating the I2cDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);

For other devices like STM32, please make sure you're using the preset pins for the I2C bus you want to use.

Default configuration with manually updating of channel statuses

var i2cDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: Mpr121.DefaultI2cAddress));
var mpr121 = new Mpr121(device: i2cDevice);

var statuses = mpr121.ReadChannelStatuses();
var status = statuses[Channels.Channel01]
    ? "pressed"
    : "released";

Debug.WriteLine($"The 1st channel is {status}");

Channel statuses auto refresh

var i2cDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: Mpr121.DefaultI2cAddress));

// Initialize controller with default configuration and auto-refresh the channel statuses every 100 ms.
var mpr121 = new Mpr121(device: i2cDevice, periodRefresh: 100);

// Subscribe to channel statuses updates.
mpr121.ChannelStatusesChanged += (object sender, ChannelStatusesChangedEventArgs e) =>
    {
        var channelStatuses = e.ChannelStatuses;
        // do something.
    };

Custom MPR121 registers configuration

var i2cDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: Mpr121.DefaultI2cAddress));
var config = new Mpr121Configuration
{
    MaxHalfDeltaRising = 0x01,
    NoiseHalfDeltaRising = 0x01,
    NoiseCountLimitRising = 0x00,
    FilterDelayCountLimitRising = 0x00,
    MaxHalfDeltaFalling = 0x01,
    NoiseHalfDeltaFalling = 0x01,
    NoiseCountLimitFalling = 0xFF,
    FilterDelayCountLimitFalling = 0x01,
    ElectrodeTouchThreshold = 0x0F,
    ElectrodeReleaseThreshold = 0x0A,
    ChargeDischargeTimeConfiguration = 0x04,
    ElectrodeConfiguration = 0x0C
};

var mpr121 = new Mpr121(device: i2cDevice, configuration: config);

This sample demonstrates how to read channel statuses using auto-refresh configuration.

Handling the channel statuses changes

mpr121.ChannelStatusesChanged += (object sender, ChannelStatusesChangedEventArgs e) =>
    {
        var channelStatuses = e.ChannelStatuses;
        // do something.
    };

Binding Notes

The binding provides different options of device configuration. The device can be configured to update the channel statuses periodically. Also it supports custom configuration of controller registers.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.907 224 10/2/2025
1.2.864 303 4/2/2025
1.2.852 274 3/11/2025
1.2.822 227 2/26/2025
1.2.775 231 2/4/2025
1.2.772 214 2/4/2025
1.2.755 224 1/31/2025
1.2.737 223 1/13/2025
1.2.704 214 12/18/2024
1.2.696 214 12/16/2024
1.2.673 251 10/23/2024
1.2.631 231 8/28/2024
1.2.590 261 7/17/2024
1.2.570 255 6/14/2024
1.2.436 351 11/10/2023
1.2.416 203 11/8/2023
1.2.329 300 5/26/2023
1.2.313 290 5/12/2023
1.2.297 282 5/3/2023
1.2.212 434 1/5/2023
1.2.203 471 12/28/2022
1.2.159 494 11/14/2022
1.2.153 541 11/5/2022
1.2.141 554 10/25/2022
1.2.87 619 9/15/2022
1.2.82 620 9/14/2022
1.1.116.8772 582 6/24/2022
1.1.113.2032 600 6/23/2022
1.1.97.17326 589 6/13/2022
1.1.92.53000 583 6/8/2022
1.1.3 626 4/15/2022
1.1.1 609 4/14/2022
1.0.300 629 3/31/2022
1.0.288-preview.114 262 3/25/2022
1.0.288-preview.113 245 3/25/2022
1.0.288-preview.104 276 3/22/2022
1.0.288-preview.100 254 3/19/2022
1.0.288-preview.98 268 3/18/2022
1.0.288-preview.93 244 3/15/2022
1.0.288-preview.87 243 3/10/2022
1.0.288-preview.65 296 2/18/2022
1.0.288-preview.29 279 1/28/2022
1.0.288-preview.20 303 1/27/2022
1.0.288-preview.1 272 1/21/2022
1.0.259 503 12/9/2021
1.0.155 508 8/31/2021
1.0.136 571 7/17/2021
1.0.134 316 7/15/2021
1.0.133 333 7/14/2021
1.0.132 356 7/8/2021
1.0.130 331 7/6/2021
1.0.129 317 7/6/2021
1.0.125 345 7/5/2021
1.0.121 339 6/29/2021
1.0.119 404 6/28/2021
1.0.105 426 5/29/2021
1.0.54 365 5/25/2021