Accessing GPIO pins on Raspberry Pi via ARBOUT
3 posts
• Page 1 of 1
Accessing GPIO pins on Raspberry Pi via ARBOUT
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
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.
Please excuse any smelling pisstakes.
-
ray - Posts: 237
- Joined: Wed Feb 24, 2010 12:24 am
- Location: Blackwater, Camberley. UK
Re: Accessing GPIO pins on Raspberry Pi via ARBOUT
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).
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.
Please excuse any smelling pisstakes.
-
ray - Posts: 237
- Joined: Wed Feb 24, 2010 12:24 am
- Location: Blackwater, Camberley. UK
Re: Accessing GPIO pins on Raspberry Pi via ARBOUT
Hi Ray,
lseek sounds right if it's a seekable device.
Regards,
Vince
lseek sounds right if it's a seekable device.
Regards,
Vince
- Vince|Dyalog
- Posts: 431
- Joined: Wed Oct 01, 2008 9:39 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group