GPIO

installer la library: apt-get install wiringpi

gpio option commande

Options:

-g

The optional -g flag causes pin numbers to be interpreted as BCM_GPIO ship pin numbers rather than BCM_PIN standard wiringPi connector pin numbers.

Commandes:

gpio option commande
gpio mode <pin> in/out/pwm/clock/up/down/tri
This sets the mode of a pin to be input, output, pwm or clock mode, and additionally can set the internal pull-up/down resistors to pull-up, pull-down or none.

gpio pwm <pin> <value>
Set the pin to a PWM value (0-1023 is supported)

gpio read <pin> / all
Reads and prints the logic value of the given pin. It will print 0 (low) or 1 (high).

gpio awrite <pin> <value>
This performs an analog read from the given pin. The Pi has no on-board analog hardware so you need to specify an external module using the -x flag.

gpio aread <pin>
This read the analog value on the given pin. The has no on-board analog hardware so you need to specify an external module using the -x flag.

gpio readall
This reads all the normally accessible pins and prints a table of their numbers (wiringPi, BCM_GPIO and physical pin numbers), so makes for a handy cross-reference chart), along with their modes and current values. This command will detect the version/model of your Pi and printout the pin diagram appropriate to your Pi.

gpio allreadall
This reads all the pins on your Raspberry Pi. It’s essentially the same format as used on the Compute Module.

gpio wfi <pin> rising/falling/both
This causes GPIO to perform a non-busy wait on a single GPIO pin until it changes state to that indicated.