# Set - Reset

A simple latch-style logic block that stores a boolean state. Use it when you want a trigger to turn something on and another trigger to turn it off, while keeping the last state between evaluations.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

* `Set` Send a TRUE signal to set the latched output.
* `Reset` Send a TRUE signal to clear the latched output.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

* `Check` Current latched boolean value (TRUE when set, FALSE when reset).

## 🕹️ Controls <a href="#controls" id="controls"></a>

No interactive controls or widgets. This block only uses its input sockets to change the latched state.

## 🎯 Features <a href="#features" id="features"></a>

* Latching behavior that preserves the last output until changed.
* `Reset` takes precedence: when `Reset` is active the output is cleared regardless of `Set`.
* Stable output suitable for feeding other logic, counters, indicators, or actuators.

## 📝 How to use <a href="#usage" id="usage"></a>

1. Connect a momentary or conditional signal to `Set` to switch the latch on.
2. Connect a separate signal to `Reset` to switch the latch off.
3. Use the `Check` output as a persistent enable/flag for subsequent processing or outputs.

## 📊 Behavior during run <a href="#evaluation" id="evaluation"></a>

* If `Reset` is TRUE the output becomes FALSE.
* Else if `Set` is TRUE the output becomes TRUE.
* Else the output remains at its previous value.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Use `Logic Input` for manual control of `Set` and `Reset` during testing.
* Pair with `Rising Edge` or `Edge Rising` when your trigger is a momentary pulse so the latch toggles only once per event.
* Use `Delay Step`, `ON Delay` or `OFF Delay` to create timed resets or to implement simple debouncing for noisy signals.
* Combine with `Counter` to count occurrences while the latch is active; feed the latch output into the counter enable.
* Use `And`, `Or` and `Not` to build more complex set/reset conditions (for example require multiple conditions before setting).
* Drive a visual indicator using `Led Output` or send the latched state to `Output` for external systems.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* If the latch never changes, verify the upstream block is sending a changing boolean and consider using `Rising Edge` to convert a continuous TRUE into a single trigger.
* If the latch immediately clears when you try to set it, check whether the `Reset` input is being driven TRUE by another block.
* For bouncing or repeated triggers, add `Delay Step` or an appropriate edge detector to avoid multiple unintended toggles.


---

# 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://docs.augelab.com/function-blocks/data-logic/logic/set-reset.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.
