# Hat switches

These functions are designed to set up a switch with directional inputs as a hat switch. Windows will recognize this as a switch with directional inputs, as opposed to just buttons with numbers.&#x20;

Typical switches are the Alps RKJX - family.&#x20;

Remember stating the amount of hat switches in[ 8\_Joystick](https://dahl-design.gitbook.io/ddc/3.-coding/essentials/08_joystick), or else your hat switch wont be recognized at all.&#x20;

#### funkyHat()

{% tabs %}
{% tab title="Description" %}
Sets up a hat switch. Does not need button numbers.
{% endtab %}

{% tab title="Example" %}
`void funkyHat(int8_t row, int8_t colUp, int8_t colRight, int8_t colDown, int8_t colLeft, int8_t hatNumber)`

Fill in the row all the funky pins go to and then up/right/down/left, in that order. Lastly the hat switch #. If you have two hat-switches, one will have to be #1, and one #2.&#x20;

`funkyHat(2,1,3,4,2,1);`

{% endtab %}

{% tab title="Requirements" %}

* None
  {% endtab %}
  {% endtabs %}


---

# 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://dahl-design.gitbook.io/ddc/switch-library/hat-switches.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.
