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

Did the PWM class change?


Best Answer Chris Walker, 14 October 2013 - 10:11 PM

Hi Frode, Before .NET MF 4.2, there was no built-in PWM class in NETMF. So we made one. For backwards-compatibility, we still provide that older class as an add-on (in SecretLabs.NETMF.Hardware.PWM.dll). But most users will want to use the newer PWM class, found in Microsoft.SPOT.Hardware.PWM. Does that get you up and running? Chris Go to the full post


  • Please log in to reply
4 replies to this topic

#1 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 14 October 2013 - 07:53 PM

Hi, 

I'm working on a class for driving a servomotor with PWM, and I'm searching around for examples on how to use PWM.

 

In all the forumthreads and blogposts I find about PWM on the Netduino they refer to a signature that looks like this:

 

new PWM(PWMChannels, Int32, Float, Bool)

 

But the PWM class I find in SecretLabs.NETMF.Hardware.PWM.dll has a signature that looks like:

 

new PWM(Cpu.Pin).

 

I'm using 4.2 .NET MF, firmware 4.2.2.2 and version 4.2.2.0 of the PWM dll.

 

Has the PWM class been changed, or am I doing something weird?



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 October 2013 - 10:11 PM   Best Answer

Hi Frode, Before .NET MF 4.2, there was no built-in PWM class in NETMF. So we made one. For backwards-compatibility, we still provide that older class as an add-on (in SecretLabs.NETMF.Hardware.PWM.dll). But most users will want to use the newer PWM class, found in Microsoft.SPOT.Hardware.PWM. Does that get you up and running? Chris

#3 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 15 October 2013 - 05:45 AM

Aha, that was the missing piece. I removed my reference to the old SecretLabs.NETMF.Hardware.PWM.dll, and added a new reference to Microsoft.SPOT.Harware.PWM, and now I see the new PWM class.

 

Thank you Chris :)



#4 engvidal

engvidal

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationGuarulhos - SP - Brazil

Posted 15 October 2013 - 02:37 PM

Dear Chris

 

When using the old SL, my pwm was at GPIO_PIN_D5 (on chip, pin 65, name PB8/Tim4_Ch3)

 

How may I reference it using the microsoft.spot.hardware.pwm ?

 

var led = new Microsoft.SPOT.Hardware.PWM( __PIN_NAME__ , 1000, 500, false);

 

thank You



#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 15 October 2013 - 03:56 PM

Hi engvidal, Use PwmChannels.PWM_PIN_D5. The PwmChannels enumeration should provide direct swaps for you. Chris




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.