This commit is contained in:
2026-01-31 23:21:25 +03:00
parent 11f07e6629
commit a6e0f2876c
7 changed files with 267 additions and 2 deletions

View File

@@ -1,3 +1,24 @@
# esp_component_template
esp_component_template
esp_component_template
#include "zh_tachometer.h"
zh_tachometer_handle_t tachometer_handle = {0};
void app_main(void)
{
esp_log_level_set("zh_tachometer", ESP_LOG_ERROR);
zh_tachometer_init_config_t config = ZH_TACHOMETER_INIT_CONFIG_DEFAULT();
config.a_gpio_number = GPIO_NUM_26;
config.b_gpio_number = GPIO_NUM_27;
config.encoder_pulses = 3600;
zh_tachometer_init(&config, &tachometer_handle);
for (;;)
{
int16_t value = 0;
zh_tachometer_get(&tachometer_handle, &value);
printf("Tachometer value is %d rpm.\n", value);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}