/// <summary> /// Writes to a rotational motor using it Velocity, Acceleration, Deceleration, Degrees per Count, and Degrees /// Motor will spin the entered degree amount and stop. /// Tries to accounts for the distance traveled when slowing down. /// May need more precision for stopping. /// </summary> public void WriteMotor(int Velocity, int Acceleration, int Deceleration, double Counts, double Degrees) { this.Degrees = Degrees; ManualMotor.InputData.SetpointVelocity.Set(Velocity); ManualMotor.InputData.Acceleration.Set(Acceleration); ManualMotor.InputData.Deceleration.Set(Deceleration); if (Degrees < 0) //Counterclockwise Spin { ManualMotor.InputData.Control_I3.Negative = false; ManualMotor.InputData.Control_I3.Positive = true; } else //Clockwise Spin { ManualMotor.InputData.Control_I3.Negative = true; ManualMotor.InputData.Control_I3.Positive = false; } UpdateMotor(); RotationalScaler Scaler = new RotationalScaler(Counts, ManualMotor.OutputData.Position.Get()); ManualMotor.AddScaler(Scaler); running = true; timer.Interval = 100; //Timer uses ms timer.Tick += new EventHandler(TimerTick); timer.Start(); }