![]() ![]() gpio mode in/out/pwm/clock/up/down/tri.See the documentation for each module type to determine the additional parameter values and functions. The first parameter is always the base pin number for this expansion module. mcp23s17), and a set of parameters separated by colons. Expansion modules are defined with their name (e.g. The optional -x flag causes the gpio program to initialise an additional expansion module. you can read the state of the output pins) Note: Pins on the PiFace are 200 through 207 for both reading and writing, with pins 208 through 215 reading the state of the output latch register (ie. The optional -p flag causes the gpio program to assume there is a PiFace board fitted to the Rasberry Pi and subsequent commands are interpreted as pins on the PiFace. The optional -1 flag causes pin numbers to be interpreted as hardware pin numbers – this works for the P1 connector only. The optional -g flag causes pin numbers to be interpreted as BCM_GPIO pin numbers rather than standard wiringPi pin numbers. See the man page for the gpio program to see what all the features are by typing man gpio Determine your Raspberry Pi board hardware revision. ![]() Set the SPI buffer size and I2C baud rate (when loading the modules).Run the i2cdetect program with appropriate flags for your Raspberry Pi board revision.Load SPI and I2C modules and set /dev/ permissions to enable read/write by the user running the gpio program.Export pins to enable edge-triggered interrupts via the /sys/class/gpio interface.Export/Unexport pins via the /sys/class/gpio interface, where they will then be available to user programs (that then do not need to be run as root or with sudo).In addition to using the gpio utility to control, read and write the GPIO pins, you can: The gpio command is designed to be installed as a setuid program and called by a normal user without using the sudo command or logging in as root.It’s even possible to write entire programs just using the gpio command in a shell-script, although it’s not terribly efficient doing it that way… Another way to call it is using the system() function in C/C++ or it’s equivalent in other programming languages. This program, called gpio, can also be used in scripts to manipulate the GPIO pins – set outputs and read inputs. WiringPi comes with a separate program to help manage the on-board GPIO interface as well as additional modules such as the PiFace and other devices like the Gertboard as well as generic GPIO expander type devices. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |