Wolfram Language code running on Raspberry Pi can read and write to the GPIO device to sense inputs and send outputs.

To Write Data...

Turn on and off an LED attached to GPIO pin 4 by writing a 1 and then a 0:

To Read Data...

Sense the state of a button attached to GPIO pin 22:

Notes

On Raspberry Pi, the GPIO device is immediately available without a connection step and does not require configuring before use.
On Raspbian versions lower than Jessie, to access GPIO you must be logged in as root or be running the Wolfram Language as root. Higher versions do not need root access.
The following GPIO pins are available for reading and writing: 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 28, 29, 30, 31.
Without configuration, GPIO pins will automatically switch between input and output on read and write. You can optionally designate GPIO pins as input only or output only with DeviceConfigure. Using a pin in a direction inconsistent with its configuration will generate an error.