gpio_control_from_command_line
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
gpio_control_from_command_line [2017/01/22 13:54] – walkeradmin | gpio_control_from_command_line [2017/01/22 16:06] – [Install WiringPi] walkeradmin | ||
---|---|---|---|
Line 42: | Line 42: | ||
Raspberry Pi ONLY. | Raspberry Pi ONLY. | ||
</ | </ | ||
+ | \\ | ||
+ | \\ | ||
+ | Another test, and something you can use a lot to check the status of the gpio is the </color red> | ||
+ | \\ | ||
+ | \\ | ||
+ | gpio readall | ||
+ | \\ | ||
+ | This will give an output similar to below (This output is from a Pi Zero v1.3) | ||
+ | \\ | ||
+ | \\ | ||
+ | < | ||
+ | | ||
+ | | BCM | wPi | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | BCM | wPi | | ||
+ | | ||
+ | </ | ||
+ | \\ | ||
+ | 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 ==== | ||
+ | \\ | ||
+ | \\ | ||
+ | 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.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1