Access GPIO on Raspberry Pi—Wolfram Language Documentation (2024)

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

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

Access GPIO on Raspberry Pi—Wolfram Language Documentation (1)

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

Access GPIO on Raspberry Pi—Wolfram Language Documentation (2)

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.

Access GPIO on Raspberry Pi—Wolfram Language Documentation (2024)
Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6109

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.