# \[Marlin] M106 - Set Fan Speed

{% hint style="success" %}
**📅Update: 2020/09/18**
{% endhint %}

## Description

Turn on one of the fans and set its speed. If no fan index is given, the print cooling fan is selected. The fan speed applies to the next block added to the planner, so it will not take effect until previous moves in the planner are done. Under manual control with an idle machine, [`M106`](https://app.gitbook.com/docs/gcode/M106.html) will change the fan speed immediately.

## Notes

* '[`M106`](https://app.gitbook.com/docs/gcode/M106.html) with no speed sets the fan to full speed.'
* Turn off fans with [`M107`](https://app.gitbook.com/docs/gcode/M107.html).

## Usage

`M106` `[I<index>]` `[P<index>]` `[S<speed>]` `[T<secondary>]`

### Parameters

* `[I<index>]` Material preset index. Overrides S.
* `[P<index>]` Fan index
* `[S<speed>]` Speed, from 0 to 255. S255 provides 100% duty cycle; S128 produces 50%.
* `[T<secondary>]` Secondary speed. Added in Marlin 1.1.7. (Requires `EXTRA_FAN_SPEED`)
  * `M106 P<fan> T3-255` sets a secondary speed for `<fan>`.
  * `M106 P<fan> T2` uses the set secondary speed.
  * `M106 P<fan> T1` restores the previous fan speed.

## Examples

Turn on the fan at 200/255 DC

```
M106 S200
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.rotrics.com/gcode/marlin-original-commands/marlin-m106-set-fan-speed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
