|
| 1 | +# Queue |
| 2 | + |
| 3 | +This example demonstrates basic usage of FreeRTOS Queues which enables tasks to pass data between each other in a secure asynchronous way. |
| 4 | +Please refer to other examples in this folder to better understand usage of tasks. |
| 5 | +It is also advised to read documentation on FreeRTOS web pages: |
| 6 | +[https://www.freertos.org/a00106.html](https://www.freertos.org/a00106.html) |
| 7 | + |
| 8 | +This example reads data received on serial port (sent by user) pass it via queue to another task which will send it back on Serial Output. |
| 9 | + |
| 10 | +### Theory: |
| 11 | +A queue is a simple to use data structure (in the most basic way) controlled by `xQueueSend` and `xQueueReceive` functions. |
| 12 | +Usually one task writes into the queue and the other task reads from it. |
| 13 | +Usage of queues enables the reading task to yield the CPU until there are data in the queue and therefore not waste precious computation time. |
| 14 | + |
| 15 | +# Supported Targets |
| 16 | + |
| 17 | +This example supports all ESP32 SoCs. |
| 18 | + |
| 19 | +## How to Use Example |
| 20 | + |
| 21 | +Flash and write anything to serial input. |
| 22 | + |
| 23 | +* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide). |
| 24 | + |
| 25 | +#### Using Arduino IDE |
| 26 | + |
| 27 | +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). |
| 28 | + |
| 29 | +* Before Compile/Verify, select the correct board: `Tools -> Board`. |
| 30 | +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. |
| 31 | + |
| 32 | +#### Using Platform IO |
| 33 | + |
| 34 | +* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file. |
| 35 | + |
| 36 | +## Example Log Output |
| 37 | + |
| 38 | +``` |
| 39 | +Anything you write will return as echo. |
| 40 | +Maximum line length is 63 characters (+ terminating '0'). |
| 41 | +Anything longer will be sent as a separate line. |
| 42 | +
|
| 43 | +``` |
| 44 | +< Input text "Short input" |
| 45 | + |
| 46 | +``Echo line of size 11: "Short input"`` |
| 47 | + |
| 48 | +< Input text "An example of very long input which is longer than default 63 characters will be split." |
| 49 | + |
| 50 | +``` |
| 51 | +Echo line of size 63: "An example of very long input which is longer than default 63 c" |
| 52 | +Echo line of size 24: "haracters will be split." |
| 53 | +``` |
| 54 | + |
| 55 | +## Troubleshooting |
| 56 | + |
| 57 | +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** |
| 58 | + |
| 59 | +## Contribute |
| 60 | + |
| 61 | +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) |
| 62 | + |
| 63 | +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! |
| 64 | + |
| 65 | +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. |
| 66 | + |
| 67 | +## Resources |
| 68 | + |
| 69 | +* Official ESP32 Forum: [Link](https://esp32.com) |
| 70 | +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) |
| 71 | +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) |
| 72 | +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) |
| 73 | +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) |
| 74 | +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) |
0 commit comments