1| Supported Targets | ESP32-S2 |
2| ----------------- | -------- |
3
4# Touch button example
5
6This example demonstrates how to use the Touch Element library of capacitive touch sensor and set up touch button.
7
8## How to use example
9
10### Configure the project
11
12* Set the target of the build (where `{IDF_TARGET}` stands for the target chip such as `esp32s2`).
13* Run `menuconfig` to select a dispatch method for the example.
14
15### Build and Flash
16
17Build the project and flash it to the target board, then run monitor tool to view serial output:
18
19```
20idf.py -p PORT flash monitor
21```
22
23(Replace PORT with the name of the serial port to use.)
24
25(To exit the serial monitor, type ``Ctrl-]``.)
26
27See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
28
29## Example Output
30
31```
32I (331) Touch Button Example: Touch element library installed
33I (331) Touch Button Example: Touch button installed
34I (341) Touch Button Example: Touch buttons created
35I (341) Touch Button Example: Touch element library start
36I (1481) Touch Button Example: Button[1] Press
37I (1701) Touch Button Example: Button[1] Release
38I (2731) Touch Button Example: Button[2] Press
39I (2921) Touch Button Example: Button[2] Release
40I (3581) Touch Button Example: Button[5] Press
41I (3781) Touch Button Example: Button[5] Release
42I (3931) Touch Button Example: Button[4] Press
43I (4121) Touch Button Example: Button[4] Release
44I (4271) Touch Button Example: Button[3] Press
45I (4491) Touch Button Example: Button[3] Release
46I (4671) Touch Button Example: Button[6] Press
47I (4891) Touch Button Example: Button[6] Release
48I (5091) Touch Button Example: Button[7] Press
49I (5311) Touch Button Example: Button[7] Release
50I (5491) Touch Button Example: Button[8] Press
51I (5741) Touch Button Example: Button[8] Release
52I (5991) Touch Button Example: Button[9] Press
53I (7991) Touch Button Example: Button[9] LongPress
54I (9991) Touch Button Example: Button[9] LongPress
55I (11991) Touch Button Example: Button[9] LongPress
56I (12881) Touch Button Example: Button[9] Release
57```
58
59See the README.md file in the upper level 'examples' directory for more information about examples.
60