Esempio n. 1
0
 public void ActivateOrHold(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.ActivateOrHoldMotor, (byte)motors });
     }
 }
Esempio n. 2
0
 public void StartContinuousRotation(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.StartContinuousRotation, (byte)motors });
     }
 }
Esempio n. 3
0
 public void TurnOff(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.TurnOffMotor, (byte)motors });
     }
 }
Esempio n. 4
0
 public void SetRotatingDirection(MotorSelection motors, RotatingDirection direction)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.SetRotationDirection, (byte)motors, (byte)direction });
     }
 }
Esempio n. 5
0
 public void SetSpeedAndAcceleration(MotorSelection motors, SpeedSetting speed, Acceleration acceleration)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.SetSpeedAndAcceleration, (byte)motors, (byte)speed, (byte)acceleration });
     }
 }
Esempio n. 6
0
 public void SetCurrent(CurrentSelection current, MotorSelection motors, uint mA, SettingsDuration duration = SettingsDuration.UntilReset)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)current, (byte)motors, (byte)(mA & 0x00FF), (byte)((mA & 0xFF00) >> 8), (byte)duration });
     }
 }
Esempio n. 7
0
 public void RotateSteps(MotorSelection motors, uint steps)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.RotateNumberOfSteps, (byte)motors, (byte)(steps & 0x00FF), (byte)((steps & 0xFF00) >> 8) });
     }
 }
Esempio n. 8
0
 public void ResetStepCounter(MotorSelection motors)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.ResetStepCounter, (byte)motors });
     }
 }
Esempio n. 9
0
 public uint[] GetStepCounter(MotorSelection motors)
 {
     lock (this)
     {
         byte[] answer = SendCommand(new byte[] { (byte)RNCommands.GetStepCounter, (byte)motors });
         uint[] steps = new uint[answer.Length / 4];
         for (int i = 0; i < answer.Length / 4; ++i)
         {
             steps[i] = 0;
             for (int j = 0; j < 4; ++j)
                 steps[i] += answer[i * 4 + j] * (uint)Math.Pow(256, j);
         }
         return steps;
     }
 }
Esempio n. 10
0
 public MotorState[] GetMotorState(MotorSelection motors)
 {
     lock (this)
     {
         byte[] answer = SendCommand(new byte[] { (byte)RNCommands.GetMotorState });
         MotorState[] states = new MotorState[answer.Length];
         for (int i = 0; i < answer.Length; ++i)
             states[i] = (MotorState)answer[i];
         return states;
     }
 }