www.8devices.com
View unanswered posts | View active topics It is currently 10 May 2024, 16:26



Reply to topic  [ 3 posts ] 
 gpio problem 
Author Message

Joined: 11 Nov 2012, 18:28
Posts: 1
Hello
please excuse my bad english
I have a problem to control the gpio pins on the carambola board
all connections working fine (serial,eth)
I can turn on & off the gpio pins with the console and
gpioctl but I tried to write a shell script and thats the problem
and google -> too many results to distinguish

#!/bin/sh

P1=1
P2=2

setup() {
# set GPIO1+2 as output
gpioctl dirout $P1
gpioctl dirout $P2
}


so it looks like this this is not the complete code but I have tried many changes
nothing work
so where I need to save the script ? ( I have saved a gpio.sh in /etc with win scp)
is it necessary to change chmod to 755 ?
what should I do to make the script available at startup/boot

I want to switch 2 relays on and off ...actually simple but not for a beginner...


11 Nov 2012, 19:49
Profile

Joined: 14 May 2012, 15:48
Posts: 196
First of all, you don't put generic scripts in /etc
Under /etc/init.d are boot up scripts that have a special header (google Linux init Scripts) and only have the purpose of running and stopping programms at a specific point in the boot process (google Linux runlevels).
If you put an executable under /bin, /usr/bin, /sbin or /usr/sbin it will be available as a console command.

Secondly, your Script doesn't do anything except define a method named "setup" ... nowhere in your script is it executed... (google Linux shell scripting tutorial)

And yes, if you want to execute a script directly it needs to be set as executable with chmod.


13 Nov 2012, 09:14
Profile

Joined: 28 Sep 2012, 08:16
Posts: 25
put your script in /etc/rc.local

rc.local is run after all the script found in /etc/rc.d (after S99sysctl)


14 Nov 2012, 13:12
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.