Accessing GPIO pins on Raspberry Pi via ARBOUT

Using Dyalog under 'nixes

Accessing GPIO pins on Raspberry Pi via ARBOUT

Postby ray on Sun Jan 05, 2014 7:20 pm

Hi

From APL, I am controlling some servos via commands like:
⎕SH 'echo 17=50% > /dev/servoblaster'
from within Dyalog APL. This is working fine.
(It sends a PWM signal of 50% to pin 17, I think.)

And I would like to use somthing like:
'/dev/servoblaster' ⎕ARBOUT '17=50%'
as this would I expect be VERY much quicker.

First: Should this work?
(And could I read the pins via ⎕ARBIN?)

Second: I tried it but the raspberry pi tells me I don't have permission.

I started up dyalog via
$sudo startx
and then selected Dyalog from the programming languages.

Any body got any ideas why I can write to /dev/servoblaster via "echo" but not ⎕ARBOUT?
(If I run "startx" without the sudo, even the echo process fails!)

Thanks for any suggestions.

Ray
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 221
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Accessing GPIO pins on Raspberry Pi via ARBOUT

Postby ray on Sat Jan 18, 2014 12:28 am

I can now write to the GPIO pins using ⎕ARBOUT.

The command to send "out" to pin 7 direction
$ echo out > /sys/class/gpio/gpio7/direction
can be sent by APL as
'/sys/class/gpio/gpio7/direction' ⎕ARBOUT (⎕UCS 'out'),10

The command to read pin 7 when "in" direction
$cat /sys/class/gpio/gpio7/direction
can de done in APL via
('' '/sys/class/gpio/gpio7/direction')⎕ARBIN ''

Question: How can I reset the nominal file pointer counter back to the first character after a ARBIN "read"?
(As there are no interrupts triggered by pin changing states, I need to read and reread the "file" in a loop
("lseek" comes to mind).
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 221
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Accessing GPIO pins on Raspberry Pi via ARBOUT

Postby Vince|Dyalog on Tue Jan 28, 2014 9:14 am

Hi Ray,

lseek sounds right if it's a seekable device.

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am


Return to UNIX and Linux

Who is online

Users browsing this forum: No registered users and 1 guest