• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

main/11-Mar-2024-12462

CMakeLists.txtD11-Mar-2024236 75

MakefileD11-Mar-2024183 92

README.mdD11-Mar-20242.6 KiB7452

example_test.pyD11-Mar-2024635 2113

README.md

1# Example: GPIO
2
3(See the README.md file in the upper level 'examples' directory for more information about examples.)
4
5This test code shows how to configure GPIO and how to use it with interruption.
6
7## GPIO functions:
8
9| GPIO     | Direction | Configuration                                          |
10| -------- | --------- | ------------------------------------------------------ |
11| GPIO18   | output    |                                                        |
12| GPIO19   | output    |                                                        |
13| GPIO4    | input     | pulled up, interrupt from rising edge and falling edge |
14| GPIO5    | input     | pulled up, interrupt from rising edge                  |
15
16## Test:
17 1. Connect GPIO18 with GPIO4
18 2. Connect GPIO19 with GPIO5
19 3. Generate pulses on GPIO18/19, that triggers interrupt on GPIO4/5
20
21## How to use example
22
23Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`.
24
25### Hardware Required
26
27* A development board with ESP32/ESP32-S2/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
28* A USB cable for Power supply and programming
29* Some jumper wires to connect GPIOs.
30
31### Configure the project
32
33### Build and Flash
34
35Build the project and flash it to the board, then run the monitor tool to view the serial output:
36
37Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
38
39(To exit the serial monitor, type ``Ctrl-]``.)
40
41See the Getting Started Guide for all the steps to configure and use the ESP-IDF to build projects.
42
43* [ESP-IDF Getting Started Guide on ESP32](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)
44* [ESP-IDF Getting Started Guide on ESP32-S2](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html)
45* [ESP-IDF Getting Started Guide on ESP32-C3](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html)
46
47## Example Output
48
49As you run the example, you will see the following log:
50
51```
52I (317) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
53I (327) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
54I (337) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1
55I (347) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1
56Minimum free heap size: 289892 bytes
57cnt: 0
58cnt: 1
59cnt: 2
60cnt: 3
61cnt: 4
62cnt: 5
63cnt: 6
64cnt: 7
65cnt: 8
66cnt: 9
67cnt: 10
68...
69```
70
71## Troubleshooting
72
73For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
74