nanoFramework.Iot.Device.Relay4 1.1.907

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Relay4 --version 1.1.907
                    
NuGet\Install-Package nanoFramework.Iot.Device.Relay4 -Version 1.1.907
                    
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.Relay4" Version="1.1.907" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Relay4" Version="1.1.907" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Relay4" />
                    
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.Relay4 --version 1.1.907
                    
#r "nuget: nanoFramework.Iot.Device.Relay4, 1.1.907"
                    
#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.Relay4@1.1.907
                    
#: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.Relay4&version=1.1.907
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Relay4&version=1.1.907
                    
Install as a Cake Tool

Module and Unit 4 Relay - I2C relay

Module and Unit 4 Relay are a realys that can be piloted thru I2C. They are available with M5Stack.

Documentation

  • The 4 Relay Module documentation can be found here
  • The 4 Relay Unit documentation can be found here

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 SPI bus you want to use. The chip select can as well be pre setup.

using Iot.Device.Relay;
using System.Device.I2c;
using System.Threading;

Unit4Relay unit4Relay = new(new I2cDevice(new I2cConnectionSettings(1, Base4Relay.DefaultI2cAddress)));
// This will synchronize the led with the relay
unit4Relay.SynchronizedMode = true;
// Set relay 2, the led 2 should be on
unit4Relay.SetRelay(2, State.On);
// Set back the asyn modo
unit4Relay.SynchronizedMode = false;
// Set relay 1, the led 1 should be off while the relay on
unit4Relay.SetRelay(1, State.On);
// Set led 0 to on, the relay should be off
unit4Relay.SetLed(0, State.On);
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.1.907 168 10/2/2025
1.1.864 252 4/2/2025
1.1.852 231 3/11/2025
1.1.822 202 2/26/2025
1.1.772 171 2/4/2025
1.1.755 206 1/31/2025
1.1.737 188 1/13/2025
1.1.696 171 12/16/2024
1.1.673 177 10/23/2024
1.1.631 203 8/28/2024
1.1.570 224 6/14/2024
1.1.436 331 11/10/2023
1.1.431 218 11/10/2023
1.1.329 268 5/26/2023
1.1.313 246 5/12/2023
1.1.297 254 5/3/2023
1.1.203 428 12/28/2022
1.1.141 510 10/25/2022
1.1.82 592 9/14/2022
1.0.102.2032 536 6/23/2022
1.0.2 567 4/19/2022
1.0.1.9945 514 7/8/2022