From eb6518f20792fb0e7be911dc6f75205ec661bdf5 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Tue, 3 Nov 2026 19:18:42 +0300 Subject: [PATCH] doc: updated readme --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a8e068e..5629762 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Using -In an existing project, run the following command to install the components: +In an existing project, run the following command to install the component: ```bash cd ../your_project/components @@ -25,7 +25,9 @@ In the application, add the component: #include "zh_tachometer.h" ``` -## Example +## Examples + +### Basic Example ```c #include "zh_tachometer.h" @@ -39,13 +41,22 @@ void app_main(void) config.a_gpio_number = GPIO_NUM_26; config.b_gpio_number = GPIO_NUM_27; config.encoder_pulses = 3600; - zh_tachometer_init(&config, &tachometer_handle); + esp_err_t ret = zh_tachometer_init(&config, &tachometer_handle); + if (ret != ESP_OK) + { + printf("Tachometer initialization error\n"); + return; + } for (;;) { uint16_t value = 0; - zh_tachometer_get(&tachometer_handle, &value); - printf("Tachometer value is %d rpm.\n", value); + ret = zh_tachometer_get(&tachometer_handle, &value); + if (ret == ESP_OK) + { + printf("Tachometer value is %u rpm.\n", value); + } vTaskDelay(100 / portTICK_PERIOD_MS); } + zh_tachometer_deinit(&tachometer_handle); } ```