[PD] gpio on the raspberry pi from within pd ?

Julian Brooks jbeezez at gmail.com
Fri Apr 12 11:30:04 CEST 2013


Morning Jaime,

Nice digging - well done.

As I don't read C I admit to being somewhat at sea with the possibilities
of the object so really good to hear someone else is rooting around in this.

I did manage to get access to the GPIO pins making use of the messages that
Charles mentioned:
sudo bash
echo "1" > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1/direction
chown pi /sys/class/gpio/gpio1/value

But really good to just do it from within Pd - how'd you get round the
sudo-thing?

Not sure what it is you're doing project-wise with the GPIO pins but I've
spent a couple of weeks digging through the somewhat endless bits and
pieces of documentation on the web so perhaps I could be of assistance with
some pointers on that front?

Most of the info/code is Python-based and there's plenty of it (I'm also a
complete noob re Python as well!)
Miller and Charles were certainly on the right track with WiringPi as I
would say it's easily the most referenced library.
.
My own interest is with getting a fairly recent i2c thermal imaging sensor
going (see other thread) and Martin Peach is giving us some invaluable help
with that but it would be my ideal scenario to be able to control, manage
and filter the sensors data from within Pd (once we get the thing going!).

My understanding from reading Miller's initial message re [gpio] is that
it's based on WiringPi so I can't help wondering if there's also a method
to include the i2c library that's a subset of WiringPi as well?  Would be
super-useful.

Obviously early days yet but I'm sure we can get there eventually.

All the best,

Julian


On 12 April 2013 06:21, J Oliver <jaime.oliver2 at gmail.com> wrote:

> Hi Julian, All,
>
> I think I've figured out the [gpio] external. It works fine, but there
> there is no documentation, however, the .c file is not very complicated.
>
> The test-gpio.pd file is not very good as documentation, so I am attaching
> a draft help file.
>
> The argument of [gpio] is the pin number. The first thing to do is [enable
> 1( and not [open 1(, which is equivalent to the:
> sudo echo "17" > /sys/class/gpio/export
> command.
>
> Then [open 1(, then [output 1/0( to choose direction and then write
> (float) to or read (bang) from the pin...
>
> There are still a few more things I need to discover, but more tomorrow
> when I have some jumper cables and feel more awake.
>
> best,
>
> J
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20130412/6e005eae/attachment-0001.htm>


More information about the Pd-list mailing list