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

PWM changes?

PWM C# 4.2.0.1

  • Please log in to reply
2 replies to this topic

#1 gartral

gartral

    New Member

  • Members
  • Pip
  • 4 posts

Posted 05 February 2014 - 11:17 PM

So, I have my netduino 1 and it's running 4.2, I have all the framework and files in place, but I'm following the RBG Led tutorials and...

PWM pwm = new PWM(Pins.GPIO_PIN_D5);

tells me

 

Error  1  'Microsoft.SPOT.Hardware.PWM' does not contain a constructor that takes 1 arguments  C:UsersrazerAppDataLocalTemporary ProjectsNetduinoApplication1Program.cs  15  23  NetduinoApplication1  

 

 

What changed, and where in the mountains of documentation have I missed the memo?



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 06 February 2014 - 12:19 AM

Hi gartral, .NET MF adds a new built-in PWM class, so you'll need to override and use the full namespace. Do this: 1. Add the "SecretLabs.NETMF.Hardware.PWM.dll" assembly as a reference to your project. 2. Change your code to use the full namespace:
SecretLabs.NETMF.Hardware.PWM pwm = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D5);
Does that get you up and running? Chris

#3 jrlyman3

jrlyman3

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts
  • LocationNorth St Paul. MN

Posted 06 February 2014 - 02:11 PM

I found that most of the examples are for 4.1 and earlier.  I finally found an example for 4.2 and it looked like this:

// This puts a continuous signal on D5 with a 1mS pulse every 3 mS.const uint period = 3; // *1000 * 1000;    // 3 msconst uint duration = 1; // *1000 * 1000;  // 1 msPWM pwm = new PWM(PWMChannels.PWM_PIN_D5, period, duration, PWM.ScaleFactor.Milliseconds, false);pwm.Period = period;pwm.Start();

Hope this helps,

 

John







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.