#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "resistive_touch.h" static const char *TAG = "touch"; void app_main(void) { bool was_pressed = false; resistive_touch_init(); ESP_LOGI(TAG, "resistive touch terminal output started"); while (1) { resistive_touch_point_t point; if (resistive_touch_read(&point)) { if (!was_pressed) { ESP_LOGI(TAG, "TOUCH DOWN"); } ESP_LOGI(TAG, "TOUCH POINT x=%u y=%u raw_x=%u raw_y=%u", point.x, point.y, point.raw_x, point.raw_y); was_pressed = true; } else if (was_pressed && !resistive_touch_is_pressed()) { ESP_LOGI(TAG, "TOUCH UP"); was_pressed = false; } vTaskDelay(pdMS_TO_TICKS(50)); } }