-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[DOCS] Writing a new Arduino documentation about GPIO #5894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
493f516
add new documation GPIO
halyssonJr 89275ee
Merge branch 'master' into master
halyssonJr 67e0370
[Docs] Removed the build folders
pedrominatel cc2321e
[Docs] Removed the unused folders
pedrominatel cbe23fe
[Docs] Removed the build folders again
pedrominatel 31b2cdf
change piMode() to pinMode and remove 'do' on warning sentence
halyssonJr a41ef07
Remove 'A'before fetures
halyssonJr 8ec5acb
add files gpios
halyssonJr ba3f718
Fix reference link and add a line after the title.
halyssonJr cb60a76
[Docs] Removed build folders
pedrominatel dfbf36a
[Docs] Added new sections to the docs and fixed issues
pedrominatel 7c219d3
[Docs] Reverted the changes on the conf.py file
pedrominatel 3a27643
[Docs] Added interrupt example and fixed code style on GPIO example
pedrominatel d899666
Merge branch 'master' into master
pedrominatel c62e73a
[Docs] Fixed typo
pedrominatel 8c7748c
Merge branch 'master' of github.com:halyssonJr/arduino-esp32
pedrominatel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,115 @@ | ||
#### | ||
GPIO | ||
#### | ||
About | ||
----- | ||
|
||
GPIO (General Purpouse Input Output) is peripheral responsible to controls reception and | ||
deliver digital signals by means of easy interface acess with world, physical pins. | ||
|
||
A fetures of this peripheral relates with largely quantity pins available on chip, also being | ||
pedrominatel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this programmable and configurable. An example of interaction happen when turn on LED or pulse control a button. | ||
|
||
.. note:: | ||
There are some GPIOs with special functions and not all the is accessible in all development board. For more information strong suggest acess datasheet. | ||
|
||
GPIOs Configuration | ||
******************* | ||
|
||
The GPIOs used two different configuration : | ||
|
||
- **Input** | ||
|
||
- Receive external digital signals | ||
|
||
|
||
- **Output** | ||
|
||
- Send internal digital signals | ||
|
||
|
||
Arduino - ESP32 API | ||
------------------------- | ||
Here are description of frequently used functions for GPIOs | ||
|
||
pinMode | ||
*********** | ||
|
||
Initial configuration for use pin with input or output. | ||
|
||
|
||
.. code-block:: arduino | ||
|
||
void piMode(uint8_t pin, uint8_t mode); | ||
pedrominatel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* ``pin`` select GPIO | ||
* ``mode`` sets mode operation (``INPUT``, ``OUTPUT`` or ``INPUT_PULLUP``, ). | ||
|
||
digitalWrite | ||
************* | ||
|
||
Write digital signal on pin. | ||
|
||
.. code-block:: arduino | ||
|
||
void digitalWrite(uint8_t pin, uint8_t val); | ||
|
||
* ``pin`` select a GPIO | ||
* ``val`` logic level write on pin (``HIGH`` or ``LOW``) | ||
|
||
.. warning:: | ||
If pin not set to ``OUTPUT`` on pinMode(), may do not work correct. | ||
pedrominatel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
digitalRead | ||
*********** | ||
|
||
Read digital pin signal picked | ||
|
||
.. code-block:: arduino | ||
|
||
int digitalRead(uint8_t pin); | ||
|
||
* ``pin`` select GPIO | ||
|
||
This function will be return logical state ``HIGH`` or ``LOW`` | ||
|
||
Simulation | ||
---------- | ||
|
||
This application helps understand concepts using dynamic simulation provide by `Wokwi`_, test the gpio code and start. | ||
pedrominatel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. raw:: html | ||
|
||
<iframe src="https://wokwi.com/arduino/projects/314835473253007936" width="100%" height="400" border="0"></iframe> | ||
|
||
|
||
.. _gpio_example_code: | ||
|
||
Example Code | ||
------------- | ||
|
||
Here is full code for example application of GPIOs | ||
|
||
.. code-block:: | ||
|
||
#define LED 12 | ||
#define BUTTON 2 | ||
|
||
uint8_t stateLED = 0; | ||
|
||
void setup() { | ||
pinMode(LED, OUTPUT); | ||
pinMode(BUTTON,INPUT_PULLUP); | ||
} | ||
|
||
void loop() { | ||
|
||
if(!digitalRead(BUTTON)){ | ||
stateLED = stateLED^1; | ||
digitalWrite(LED,stateLED); | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.