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

V4.2 PWM class


  • Please log in to reply
2 replies to this topic

#1 Ben Harel

Ben Harel

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 22 November 2012 - 07:30 PM

Hi! How do I use the PWM class on version 4.2?Every example I find is for the previouse versions(new PWM(Pins.GPIO_PIN_D6)),but now it requires four variables.I want to write the following code(netmftoolbox - HBridge),but I cant,beause the class wont match. (sorry for my english). HBridge MotorDriver = new HBridge(new Netduino.PWM(Pins.GPIO_PIN_D6), Pins.GPIO_PIN_D7, new Netduino.PWM(Pins.GPIO_PIN_D5), Pins.GPIO_PIN_D4); // Motor 1 half speed backward MotorDriver.SetState(HBridge.Motors.Motor1, -50); // Motor 2 half speed forward MotorDriver.SetState(HBridge.Motors.Motor2, 50); // Lets run for 5 seconds Thread.Sleep(5000); // Motor 1 full speed backward MotorDriver.SetState(HBridge.Motors.Motor1, -100); // Motor 2 full speed forward MotorDriver.SetState(HBridge.Motors.Motor2, 100); // Lets run for 5 seconds Thread.Sleep(5000); // Stops both motors MotorDriver.SetState(HBridge.Motors.Motor1, 0); MotorDriver.SetState(HBridge.Motors.Motor2, 0); } } } Thank you very much for your help! EDIT: All I needed to change is from new Netduino.PWM to: PWMChannels. BUT I still need help in order to connect other stuff like leds.

#2 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 22 November 2012 - 07:47 PM

Hi!
How do I use the PWM class on version 4.2?Every example I find is for the previouse versions(new PWM(Pins.GPIO_PIN_D6)),but now it requires four variables.I want to write the following code(netmftoolbox - HBridge),but I cant,beause the class wont match. (sorry for my english).

Ben,

Nothing wrong with your English. B)

Checkout this link and see if that helps. PWM Example

If not please provide a little more information. i.e. Which board, Visual Basic or C# and which firmware is loaded on the board.

Also if this doesn't help Gutworks is normal on and off of the Chat room, he knows a fair amount on PWM coding.

Hope this helps,
Chuck

#3 Ben Harel

Ben Harel

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 22 November 2012 - 08:04 PM

Thank you. I am using the Netduino Plus,firmware 4.2 and coding in C#. I'd love an explanation for each variable on the constructor,let's say for a led/DC motor.(Whats the dutyCycle?frequency? I'll try to contact Gutworks,thanks for the tips.




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.