Skip to content

Commit 3a27643

Browse files
committed
[Docs] Added interrupt example and fixed code style on GPIO example
1 parent 7c219d3 commit 3a27643

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

docs/source/api/gpio.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,29 +136,35 @@ To detach the interruption from a specific pin, use the ``detachInterrupt`` func
136136
.. _gpio_example_code:
137137

138138
Example Code
139-
-------------
139+
------------
140140

141-
Here is the full code for the GPIO application example.
141+
GPIO Input and Output Modes
142+
***************************
142143

143-
.. code-block::
144+
.. code-block:: arduino
144145
145146
#define LED 12
146147
#define BUTTON 2
147-
148+
148149
uint8_t stateLED = 0;
149-
150+
150151
void setup() {
151152
pinMode(LED, OUTPUT);
152153
pinMode(BUTTON,INPUT_PULLUP);
153154
}
154155
155156
void loop() {
156-
157+
157158
if(!digitalRead(BUTTON)){
158159
stateLED = stateLED^1;
159160
digitalWrite(LED,stateLED);
160161
}
161162
}
162163
163-
.. _Wokwi: https://wokwi.com/
164+
GPIO Interrupt
165+
**************
166+
167+
.. literalinclude:: ../../../libraries/ESP32/examples/GPIO/GPIOInterrupt/GPIOInterrupt.ino
168+
:language: arduino
169+
164170
.. _datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf

0 commit comments

Comments
 (0)