public int ServoGetAngle(ServoIndex axisIndex) { byte[] buff = new[] { (byte)ServoCommands.GetAngle, } .Concat(((byte)axisIndex).NumToArray()); byte[] answer = SendCommand(ControllerEnum.ServoController, buff, true); return(answer.ArrayToNum()); }
//angle must be in [0, 180] range public bool ServoSetAngle(ServoIndex axisIndex, int angle) { if (angle < MinServoAngle || angle > MaxServoAngle) { return(false); } byte[] buff = new [] { (byte)ServoCommands.SetAngle, } .Concat(((byte)axisIndex).NumToArray()) .Concat(Delimiter) .Concat(angle.NumToArray()); SendCommand(ControllerEnum.ServoController, buff); return(true); }