Prerequisites
The pi user is member of all the required groups by default. To check group membership, the id command can be used.
The piio command
To be able to use the piio command, the user must be a member of the gpio group.
The twowire command
For the twowire command, the user must be a member of the i2c group and i2c functionality must be enabled on the Raspberry Pi:
- Run
sudo raspi-config. - Navigate to "Interface Options" and press Enter
- Navigate to "I2C" and press Enter
- Select "<Yes>" when asked to enable I2C
- Select "<Ok>"
- Select "<Finish>"
The spi command
For the spi command, the user must be a member of the spi group and spi functionality must be enabled on the Raspberry Pi:
- Run
sudo raspi-config. - Navigate to "Interface Options" and press Enter
- Navigate to "SPI" and press Enter
- Select "<Yes>" when asked to enable SPI
- Select "<Ok>"
- Select "<Finish>"