Toolbox.NETMF.Hardware.Netduino.PWM

This class uses the IPWMPort interface.

Toolbox.NETMF.Hardware.Netduino.PWM(Pin)
  • Pin The PWM output pin

Methods

See the interface IPWMPort for a full list of methods

Sample code in C#

IPWMPort Led1 = new Netduino.PWM(Pins.GPIO_PIN_D5);
Led1.StartPulse();

while (true)
{
    for (uint Brightness = 0; Brightness < 100; ++Brightness)
    {
        Led1.SetDutyCycle(Brightness);
        Thread.Sleep(100);
    }
    for (uint Brightness = 100; Brightness > 0; --Brightness)
    {
        Led1.SetDutyCycle(Brightness);
        Thread.Sleep(100);
    }
}

Sample code in VB

Dim Led1 As IPWMPort = New Netduino.PWM(Pins.GPIO_PIN_D5)
Led1.StartPulse()

Do
    For Brightness As Integer = 0 To 99
        Led1.SetDutyCycle(CUInt(Brightness))
        Thread.Sleep(100)
    Next
    For Brightness As Integer = 100 To 1 Step -1
        Led1.SetDutyCycle(CUInt(Brightness))
        Thread.Sleep(100)
    Next
Loop

Last edited Jul 2, 2012 at 10:05 AM by Garrcomm, version 5