nanoFramework.Iot.Device.RgbDiode 1.0.42

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.RgbDiode --version 1.0.42
NuGet\Install-Package nanoFramework.Iot.Device.RgbDiode -Version 1.0.42
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.RgbDiode" Version="1.0.42" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.RgbDiode --version 1.0.42
#r "nuget: nanoFramework.Iot.Device.RgbDiode, 1.0.42"
#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.RgbDiode as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.RgbDiode&version=1.0.42

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

RGB diode - PWM

Library designed for controlling RGB diodes using PWM.

Functions

The binding supports the following sensor functions:

  • Control of RGB diodes
  • PWM-based color intensity management

Classes

  • RgbDiode: Main class for RGB LED control

Usage

using Iot.Device.RgbDiode;
using System.Drawing;

const byte redGpioPin = 25;
const byte greenGpioPin = 27;
const byte blueGpioPin = 26;

// Uncomment for ESP32
// nanoFramework.Hardware.Esp32.Configuration.SetPinFunction(redGpioPin, nanoFramework.Hardware.Esp32.DeviceFunction.PWM1);
// nanoFramework.Hardware.Esp32.Configuration.SetPinFunction(greenGpioPin, nanoFramework.Hardware.Esp32.DeviceFunction.PWM2);
// nanoFramework.Hardware.Esp32.Configuration.SetPinFunction(blueGpioPin, nanoFramework.Hardware.Esp32.DeviceFunction.PWM3);

var pwm = new RgbDiode(redGpioPin, greenGpioPin, blueGpioPin);
pwm.SetColor(255, 0, 0); // Should display red
pwm.SetColor(0, 255, 0); // Should display green
pwm.SetColor(0, 0, 255); // Should display blue

pwm.SetColor(Color.LawnGreen);
pwm.SetColor(Color.OrangeRed);
pwm.SetColor(Color.Teal);

pwm.Transition(Color.FromArgb(0, 255, 0)); // Will fade blue to green
pwm.Transition(Color.FromArgb(255, 0, 0)); // Will fade green to red

Important: make sure you properly setup the PWM pins especially for ESP32 before creating the RgbDiode.

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.0.42 195 3/5/2024
1.0.25 238 2/5/2024
1.0.18 268 1/30/2024
1.0.8 306 1/18/2024
1.0.7 274 1/18/2024