# ButtonToggle

## `ButtonToggle` (FB)

FUNCTION\_BLOCK ButtonToggle

### Short description

> Switching element with button and central control.\
> Typical application: light pushbutton and light output.

### Representation

<figure><img src="/files/0a5d95ae746e671b7892c60da011400077b01b1e" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name          | Data type | Value range | Initial value | Function                 |
| ------------- | --------- | ----------- | ------------- | ------------------------ |
| *xButton*     | BOOL      |             |               | Input - operating button |
| *xCentralOn*  | BOOL      |             |               | Central switch-on        |
| *xCentralOff* | BOOL      |             |               | Central switch-off       |

#### Outputs

| Name   | Data type | Value range | Initial value | Function        |
| ------ | --------- | ----------- | ------------- | --------------- |
| *xOut* | BOOL      |             |               | Enable - output |

#### Setpoints / Parameters

| Name            | Data type | Value range | Initial value | Function              |
| --------------- | --------- | ----------- | ------------- | --------------------- |
| **xButtonVisu** | BOOL      |             | FALSE         | Function as *xButton* |

### Function description

#### General

The function block is generally used for direct control of the enable - output *xOut* depending on the rising edges at the inputs *xButton* (= operating button), *xCentralOn* (= central switch-on), *xCentralOff* (= central switch-off) and the setpoint / parameter **xButtonVisu**.\
Every rising edge at the input - operating button *xButton* and / or at the setpoint / parameter **xButtonVisu** switches the output *xOut* to the opposite state, provided no central control is taking place.\
If no rising edges are detected, the state of the enable - output *xOut* does not change.

#### Function table

| *xButton* or **xButtonVisu** | *xCentralOn*     | *xCentralOff*    | *xOut*                     | Note                                  |
| ---------------------------- | ---------------- | ---------------- | -------------------------- | ------------------------------------- |
| FALSE, TRUE, H/L             | FALSE, TRUE, H/L | FALSE, TRUE, H/L | unchanged                  | Inputs not active                     |
| L/H                          | FALSE, TRUE, H/L | FALSE, TRUE, H/L | FALSE > TRUE, TRUE > FALSE | State change at the output            |
| FALSE, TRUE, H/L             | L/H              | FALSE, TRUE, H/L | TRUE                       | Central switch-on                     |
| FALSE, TRUE, H/L             | FALSE, TRUE, H/L | L/H              | FALSE                      | Central switch-off                    |
| L/H                          | L/H              | FALSE, TRUE, H/L | TRUE                       | Central switch-on (higher priority)   |
| L/H                          | L/H              | L/H              | FALSE                      | Central switch-off (highest priority) |

Legend: L/H … rising edge, H/L … falling edge

### CODESYS

InOut:

| Scope       | Name          | Type   | Initial |
| ----------- | ------------- | ------ | ------- |
| Input       | `xButton`     | `BOOL` |         |
| Input       | `xCentralOn`  | `BOOL` |         |
| Input       | `xCentralOff` | `BOOL` |         |
| Input Const | `xButtonVisu` | `BOOL` | FALSE   |
| Output      | `xOut`        | `BOOL` |         |


---

# 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://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/button/buttontoggle.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.
