Group Abstract Group Abstract

Message Boards Message Boards

0
|
15.2K Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Anyone driven the GPIO pins of the Raspberry Pi B+ model

Posted 11 years ago

The documentation for DeviceWrite["GPIO" .. still seems exclusively for the 26 pin header of the B version. Has anyone successfully driven the pins of the new 40-pin B+ header from Wolfram?

POSTED BY: David Keith
7 Replies

I wasn't familiar with that library; will have to check it out.

POSTED BY: BoB LeSuer
Posted 11 years ago

Thanks, Bob. I'm having no trouble driving the pins and the SPI using the C library at airspayce.com. (It's a really nice library.) Also OK with Python. I only have problems from Wolfram.

POSTED BY: David Keith

I've had luck compiling wiringPi libraries using WolframLink. Granted, this is with the model B; however, the WiringPi libraries have been updated for B+ and therefore this method should be viable.

POSTED BY: BoB LeSuer
Posted 11 years ago

I can also toggle GPIO13 by echoing to the sysfs class files from the command line. But with the same setup, WL does not toggle the pin, either within "sudo wolfram" or withing wolfram executed under a "sudo -i" root user session.

POSTED BY: David Keith
Posted 11 years ago
POSTED BY: David Keith
Posted 11 years ago
POSTED BY: David Keith

We have not yet added support for this in the device functions (DeviceConfigure/DeviceRead/DeviceWrite), but this will be supported.

But it is possible to do this yourself as well, and it isn't very difficult.

Remember to launch the Wolfram Language as root (i.e.: sudo wolfram), because the GPIO modifications require root level access:

gpioExport[n_Integer] := Put[n, "/sys/class/gpio/export"]
gpioDirection[n_Integer, dir_] :=  Put[dir, "/sys/class/gpio/gpio" <> ToString[n] <> "/direction"]
gpioValue[n_Integer, val_] :=  Put[val, "/sys/class/gpio/gpio" <> ToString[n] <> "/value"]

And then, for example, this will turn on an LED if it is properly hooked up to GPIO13:

gpioExport[13]
gpioDirection[13,out]
gpioValue[13,1]
POSTED BY: Arnoud Buzing
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard