/// <summary>
        /// Creates a movement in the right form to Arduino. It uses 4 bits of the less significative bits of a byte.
        /// </summary>
        /// <param name="mov">The movement</param>
        /// <returns>A byte with the 4 less significative bits used to represent a movement.</returns>
        public static byte CreateMovement(Movement mov)
        {
            byte command = 0;

            if (mov.Type.Equals(TurnType.HalfTurnRight))
                command |= TYPE_HALF_RIGHT;
            else if (mov.Type.Equals(TurnType.HalfTurnLeft))
                command |= TYPE_HALF_LEFT;
            else
                command |= TYPE_FULL;

            if (mov is RotateCubeMovement)
            {
                command |= ROTATE_CUBE;
                if (((RotateCubeMovement)mov).Axis.Equals(CoordinateAxis.X))
                    command |= FRONT_CLAW;
                else if (((RotateCubeMovement)mov).Axis.Equals(CoordinateAxis.Y))
                    command |= LEFT_CLAW;
            }
            else if (mov is RotateFaceMovement)
            {
                command |= ROTATE_FACE;
                if (((RotateFaceMovement)mov).PositionFace.Equals(RobotCubeSolver.Claw_F))
                    command |= FRONT_CLAW;
                else if (((RotateFaceMovement)mov).PositionFace.Equals(RobotCubeSolver.Claw_L))
                    command |= LEFT_CLAW;
            }
            return command;
        }
        /// <summary>
        /// Add a rotation movement if needed
        /// </summary>
        /// <param name="movement">Kind of movement to know what face must be brought to some of the claws</param>
        /// <param name="nextMovement">Next movement to optimize and reduce the number of cube rotations</param>
        /// <returns></returns>
        private List<Movement> AdjustMovement(Movement movement, Movement nextMovement)
        {
            List<Movement> adjustedMovements = new List<Movement>();

            if ((movement is RotateFaceMovement) && (nextMovement is RotateFaceMovement))
            {
                RotateFaceMovement mov = (RotateFaceMovement) movement;
                RotateFaceMovement nextMov = (RotateFaceMovement) nextMovement;
                mov.PositionFace = Cube[Cube[mov.Face]];
                BringFaceToSomeClaw(mov.PositionFace, Cube[Cube[nextMov.Face]], adjustedMovements);
                mov.PositionFace = Cube[Cube[mov.Face]];
            }

            // coloca o próprio movimento, no final

            adjustedMovements.Add(movement);
            return adjustedMovements;
        }