code: public static byte[] setMode(byte pinId, Pin.Mode mode) {
          if (mode == Pin.Mode.UNSUPPORTED) {
              throw new IllegalArgumentException("Cannot set unsupported mode to pin " + pinId);
          }
          return new byte[]{SET_PIN_MODE, pinId, (byte) mode.ordinal()};
      }
docs: Creates the message that assigns particular mode to specified pin.
  
  @param pinId index of the pin
  @param mode mode
  @return message that assigns particular mode to specified pin