nanoFramework.Iot.Device.Relay4 1.1.436

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Relay4 --version 1.1.436
NuGet\Install-Package nanoFramework.Iot.Device.Relay4 -Version 1.1.436
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.436" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Relay4 --version 1.1.436
#r "nuget: nanoFramework.Iot.Device.Relay4, 1.1.436"
#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.
// Install nanoFramework.Iot.Device.Relay4 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Relay4&version=1.1.436

// Install nanoFramework.Iot.Device.Relay4 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Relay4&version=1.1.436

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.436 222 11/10/2023
1.1.431 95 11/10/2023
1.1.329 146 5/26/2023
1.1.313 123 5/12/2023
1.1.297 131 5/3/2023
1.1.203 286 12/28/2022
1.1.141 371 10/25/2022
1.1.82 444 9/14/2022
1.0.102.2032 394 6/23/2022
1.0.2 404 4/19/2022
1.0.1.9945 377 7/8/2022