ESP32_TOUCH #86
Answered
by
Mair
nuhaildam
asked this question in
Course Qeustions
ESP32_TOUCH
#86
-
Beta Was this translation helpful? Give feedback.
Answered by
Mair
Apr 24, 2022
Replies: 1 comment
-
|
@nuhaildam In short to correct this I added this line #define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM4full source #include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/touch_pad.h"
#define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM4
void app_main()
{
touch_pad_init();
touch_pad_set_voltage(TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_1V);
touch_pad_config(TOUCH_PAD_GPIO13_CHANNEL, -1);
touch_pad_filter_start(10);
uint16_t val;
uint16_t touch_filter_value = 0;
uint16_t touch_rawValue = 0;
while (true)
{
touch_pad_read_raw_data(TOUCH_PAD_GPIO13_CHANNEL, &touch_rawValue);
touch_pad_read_filtered(TOUCH_PAD_GPIO13_CHANNEL, &touch_filter_value);
touch_pad_read(TOUCH_PAD_GPIO13_CHANNEL, &val);
printf("val = %d raw = %d filtered = %d\n", val, touch_rawValue, touch_filter_value);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mair
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

@nuhaildam
Thanks for pointing this out.
Yes there was an update on the IDF that has changed this.
I have updated the video. please see https://learnesp32.com/videos/9/10_touch at 3:52
In short to correct this I added this line
full source