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.
V4.2 PWM class
Started by Ben Harel, Nov 22 2012 07:30 PM
2 replies to this topic
#1
Posted 22 November 2012 - 07:30 PM
#2
Posted 22 November 2012 - 07:47 PM
Ben,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).
Nothing wrong with your English.
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
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