gpio_control_from_command_line
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
gpio_control_from_command_line [2017/01/22 13:58] – walkeradmin | gpio_control_from_command_line [2023/03/09 22:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 47: | Line 47: | ||
\\ | \\ | ||
\\ | \\ | ||
- | gpio -readall | + | gpio readall |
\\ | \\ | ||
This will give an output similar to below (This output is from a Pi Zero v1.3) | This will give an output similar to below (This output is from a Pi Zero v1.3) | ||
Line 81: | Line 81: | ||
</ | </ | ||
\\ | \\ | ||
+ | It can be seen that this Pi has GPIO set to OUT and some to IN. I am using the Pi as a clock, so these are the lines going to my LED display. | ||
+ | \\ | ||
+ | \\ | ||
---- | ---- | ||
==== Using gpio command ==== | ==== Using gpio command ==== | ||
\\ | \\ | ||
\\ | \\ | ||
+ | Before looking at the commands, there is a switch I want to talk about, this is <color red> | ||
+ | \\ | ||
+ | \\ | ||
+ | To set the function of the GPIO pin, use <color red>gpio -g mode</ | ||
+ | \\ | ||
+ | \\ | ||
+ | using BCM number | ||
+ | gpio -g mode 18 out - Sets GPIO18 to OUTput mode (GPIO18 is physical pin 12) | ||
+ | | ||
+ | using pin instead of bcm | ||
+ | gpio mode 12 out - Sets GPIO18 to OUTput mode (GPIO18 is physical pin 12) | ||
+ | | ||
+ | Modes are In, Out, PWM, Up, Down and Tri. | ||
+ | \\ | ||
+ | \\ | ||
+ | Set GPIO pin to 1 or 0 | ||
+ | \\ | ||
+ | \\ | ||
+ | gpio -g write 18 0 - sets GPIO18 to a zero. | ||
+ | | ||
+ | gpio -g write 18 1 - sets GPIO18 to a one. | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | | ||
gpio_control_from_command_line.1485093495.txt.gz · Last modified: 2023/03/09 22:35 (external edit)