![]() |
VOOZH | about |
dotnet add package nanoFramework.System.Device.Pwm --version 1.1.23
NuGet\Install-Package nanoFramework.System.Device.Pwm -Version 1.1.23
<PackageReference Include="nanoFramework.System.Device.Pwm" Version="1.1.23" />
<PackageVersion Include="nanoFramework.System.Device.Pwm" Version="1.1.23" />Directory.Packages.props
<PackageReference Include="nanoFramework.System.Device.Pwm" />Project file
paket add nanoFramework.System.Device.Pwm --version 1.1.23
#r "nuget: nanoFramework.System.Device.Pwm, 1.1.23"
#:package nanoFramework.System.Device.Pwm@1.1.23
#addin nuget:?package=nanoFramework.System.Device.Pwm&version=1.1.23Install as a Cake Addin
#tool nuget:?package=nanoFramework.System.Device.Pwm&version=1.1.23Install as a Cake Tool
👁 Quality Gate Status
👁 Reliability Rating
👁 NuGet
👁 #yourfirstpr
👁 Discord
| Component | Build Status | NuGet Package |
|---|---|---|
| System.Device.Pwm | 👁 Build Status |
👁 NuGet |
You can create a PWM channel from a pin number, this is the recommended way. Keep in mind, you will have to allocate the pin in the case of ESP32 and make sure your pin is PWM enabled for STM32 devices.
// Case of ESP32, you need to set the pin function, in this example PWM3 for pin 18:
Configuration.SetPinFunction(18, DeviceFunction.PWM3);
PwmChannel pwmPin = PwmChannel.CreateFromPin(18, 40000);
// You can check then if it has created a valid one:
if (pwmPin != null)
{
// You do have a valid one
}
You can adjust the duty cycle by using the property:
pwmPin.DutyCycle = 0.42;
The duty cycle goes from 0.0 to 1.0.
It is recommended to setup the frequency when creating the PWM Channel. You can technically change it at any time but keep in mind some platform may not behave properly when adjusting this element.
You can as well, if you know the chip/timer Id and the channel use the create function:
PwmChannel pwmPin = new(1, 2, 40000, 0.5);
This is only recommended for advance users.
PWM precision may vary from platform to platform. It is highly recommended to check what precision can be achieved, either with the frequency, either with the duty cycle.
For documentation, providing feedback, issues and finding out how to contribute please refer to the Home repo.
Join our Discord community here.
The list of contributors to this project can be found at CONTRIBUTORS.
The nanoFramework Class Libraries are licensed under the .
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the .NET Foundation Code of Conduct.
This project is supported by the .NET Foundation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net net is compatible. |
Showing the top 5 NuGet packages that depend on nanoFramework.System.Device.Pwm:
| Package | Downloads |
|---|---|
|
nanoFramework.Iot.Device.Buzzer
This package includes the .NET IoT Core binding Iot.Device.Buzzer for .NET nanoFramework C# projects. |
|
|
nanoFramework.M5Core2
This package includes the nanoFramework.M5Core2 assembly for .NET nanoFramework C# projects. |
|
|
nanoFramework.MagicBit
This package includes nanoFramework.MagicBit, a board package library for MagicBit in .NET nanoFramework C# projects. |
|
|
nanoFramework.Iot.Device.DCMotor
This package includes the .NET IoT Core binding Iot.Device.DCMotor for .NET nanoFramework C# projects. |
|
|
nanoFramework.Iot.Device.ServoMotor
This package includes the .NET IoT Core binding Servo Motor for .NET nanoFramework C# projects. |
Showing the top 3 popular GitHub repositories that depend on nanoFramework.System.Device.Pwm:
| Repository | Stars |
|---|---|
|
nanoframework/Samples
🍬 Code samples from the nanoFramework team used in testing, proof of concepts and other explorational endeavours
|
|
|
nanoframework/nanoFramework.IoT.Device
📦 This repo includes .NET nanoFramework implementations for various sensors, chips, displays, hats and drivers
|
|
|
nanoframework/nanoFramework.M5Stack
📦 Board support package for M5Stack, M5StickC and M5StickCPlus for .NET nanoFramework
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-preview.12 | 138 | 5/25/2026 |
| 2.0.0-preview.11 | 173 | 5/11/2026 |
| 2.0.0-preview.10 | 113 | 4/27/2026 |
| 2.0.0-preview.9 | 97 | 4/20/2026 |
| 2.0.0-preview.7 | 267 | 1/14/2026 |
| 2.0.0-preview.6 | 90 | 1/12/2026 |
| 2.0.0-preview.5 | 97 | 1/7/2026 |
| 2.0.0-preview.2 | 87 | 1/5/2026 |
| 2.0.0-preview.1 | 267 | 12/18/2025 |
| 1.1.23 | 7,090 | 4/2/2025 |
| 1.1.22 | 1,249 | 3/10/2025 |
| 1.1.21 | 3,109 | 2/25/2025 |
| 1.1.20 | 2,815 | 2/4/2025 |
| 1.1.19 | 1,443 | 1/30/2025 |
| 1.1.10 | 21,098 | 11/9/2023 |
| 1.1.6 | 29,826 | 12/22/2022 |
| 1.1.4 | 503 | 12/22/2022 |
| 1.0.1 | 132,873 | 3/28/2022 |
| 1.0.1-preview.15 | 335 | 3/28/2022 |
| 1.0.1-preview.13 | 505 | 3/17/2022 |