Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Missing PWM Class Netduino Plus 2

PWM using NetduinoPlus2

  • Please log in to reply
1 reply to this topic

#1 HenrikJual

HenrikJual

    New Member

  • Members
  • Pip
  • 1 posts

Posted 21 March 2015 - 07:30 PM

I am working on a project to make a Netduino Plus 2 control the drive hydraulics on a small tractor and I stumbled over some trouble using the PWM class. In the simple example below I have marked in bold where the compiler does not recognize the PWM class.

 

I have noticed that the list of usings contains the NetduinoPlus using where as all the code examples I have seen on-line all use the ..Netduino; using.

 

I hope that some body can find a moment to comment on this - thank you.

 

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
 
 
namespace RGB_Led
{
    public class Program
    {
        public static void Main()
        {
            PWM redLed = new PWM(PWMChannels.PWM_PIN_D9, 200, 60, false);
            
            redLed.DutyCycle = 60;
 
            Thread.Sleep(Timeout.Infinite);
        }
    }



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 24 March 2015 - 08:03 PM

Hi Henrik,

Sorry for the troubles. Newer versions of .NET MF introduced a new integrated PWM class--and so Visual Studio is presumably seeing the integrated PWM class (which has a different set of constructor parameters, etc.)

You can still use the old class though. Just add SecretLabs.NETMF.Hardware.PWM.dll as a reference to your project and then add "SecretLabs.NETMF.Hardware." in front of your PWM declaration/constructor.

Like this:
SecretLabs.NETMF.Hardware.PWM redLed = new SecretLabs.NETMF.Hardware.PWM(PWMChannels.PWM_PIN_D9, 200, 60, false);
Does that get you up and running?

Welcome to the Netduino community!

Chris





Also tagged with one or more of these keywords: PWM, using, NetduinoPlus2

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.