Skip to main content
Any Framework

Iot.Device.RgbDiode assembly for .NET nanoFramework C# projects

Published
Feb 27, 2025
1y ago
Total Downloads
6.8K
6,841

Install

dotnet add package nanoFramework.Iot.Device.RgbDiode --version 1.0.366

No framework information available.

README

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.

Changes from Previous Version

No structural changes between v1.0.359 and v1.0.366.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.