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.
I try to use this drive code for my ESC (Mistery FM30A) and netuduino 2 plus, but I have some question because this code work on MF 4.1...
I need the confirm for this changes in MF 4.2:
MF 4.1 Code: (Costructor)
/// <summary>
/// Create the PWM pin, set it low and configure
/// timing settings
/// </summary>
/// <param name="pin"></param>
public SpeedController(Cpu.Pin pin, SpeedControllers escModel)
{
// Set up the PWM port
esc = new PWM((Cpu.Pin)pin);
// Bind the ESC settings
this.escModel = escModel;
// Pull the throttle all the way out
Throttle = 0;
// Arm the ESC
Thread.Sleep(escModel.armPeriod);
}
... ... ....
public static void Main()
{
SpeedController xl5 = new SpeedController(Pins.GPIO_PIN_D9, new TRAXXAS_XL5());
... ...
MF 4.2 Code:
public SpeedController(Cpu.PWMChannel pin, SpeedControllers escModel){ // Set up the PWM port esc = new PWM(pin, 20000, 1500, PWM.ScaleFactor.Microseconds, false); // Bind the ESC settings this.escModel = escModel; // Pull the throttle all the way out Throttle = 0; // Arm the ESC Thread.Sleep(escModel.armPeriod);}... ... ... public static void Main(){ SpeedController xl5 = new SpeedController(PWMChannels.PWM_PIN_D9, new TRAXXAS_XL5());.....
?
?
?
?
?
?
MF 4.1 Code:
public void disengage(){ esc.SetDutyCycle(0);}......// Step the wave up or down// I absolutely hate doing it this way, but really, there's no other better way. if (value < currentThrottle){ for (int set = currentThrottle; set >= value; set--) { // Set the pulse esc.SetPulse(20000, (uint)map(set, 0, 100, range[0], range[1])); Thread.Sleep(rampIterationPause); }}else{ for (int set = currentThrottle; set <= value; set++) { esc.SetPulse(20000, (uint)map(set, 0, 100, range[0], range[1])); Thread.Sleep(rampIterationPause); }}
MF 4.2 code
public void disengage(){ esc.Duration = 0;}......// Step the wave up or down// I absolutely hate doing it this way, but really, there's no other better way. if (value < currentThrottle){ for (int set = currentThrottle; set >= value; set--) { // Set the pulse esc.Duration = (uint)map(set, 0, 100, range[0], range[1]); Thread.Sleep(rampIterationPause); }}else{ for (int set = currentThrottle; set <= value; set++) { esesc.Duration = (uint)map(set, 0, 100, range[0], range[1]); Thread.Sleep(rampIterationPause); }}