# Keyboard/Barcode Reader

This function block is designed to read keyboard and barcode inputs in real-time. It can switch between modes to handle key presses or barcode reading seamlessly.

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

This function block does not have any inputs.

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

`String` Outputs the latest keyboard input or barcode read.

`Boolean` A true or false value signaling whether a new input has been registered.

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

`Mode` A dropdown that allows users to choose between two modes:

* **Key Press**: Reads individual key presses.
* **Barcode Reading**: Reads a sequence of keystrokes as a barcode.

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

`Real-Time Input` The block captures input instantly and continuously, making it suitable for dynamic environments where quick data entry is essential.

`Flexible Modes` Switch between reading simple key presses or full barcode sequences effortlessly.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. **Select Mode**: Choose either `Key Press` for individual key input or `Barcode Reading` to read input sequences as barcodes.
2. **Connect Outputs**: Link the outputs to other blocks as needed for processing the read input.
3. **Read Input**: The system reads inputs immediately, making them available for further use in real-time scenarios.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When executed, this function block will continuously listen for input and return the latest value registered alongside a boolean indicating whether a new entry has been received.

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

<details>

<summary>Barcode Reading Setup</summary>

Ensure your barcode scanner is configured to send an "Enter" key after scanning. This enables the block to properly accumulate the input into a single string.

</details>

<details>

<summary>Mode Switching</summary>

You can switch modes dynamically while the function block is running. Make sure to check the output to confirm which mode it is currently set to.

</details>

<details>

<summary>Testing Key Presses</summary>

For testing purposes, you can manually type key inputs in the `Key Press` mode while observing the output in real-time to verify that key detection is working correctly.

</details>

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

<details>

<summary>No Input Detected</summary>

If you are not receiving any input, check if the function block is properly initialized and that there are no other applications or systems intercepting keyboard events.

</details>

<details>

<summary>Incorrect Barcode Reads</summary>

Make sure the barcode scanner sends a termination character (like "Enter") after each scan, as this character is crucial for the block to successfully capture and process the input.

</details>
