simplify wiringpi


3 posts
by desmondttm123 » Thu Jun 27, 2013 4:20 am
hello guys! i recently installed wiring pi and to test it, i decided to turn on a simple LED. however i find it a bit tedious to turn on a simple LED. i have to type in gpio write 1 1 and so on. i was wondering if there are ways to simplify these commands? or maybe alternative ways to activate? such as via phone? thanks
Posts: 103
Joined: Tue May 07, 2013 6:13 am
by rpdom » Thu Jun 27, 2013 4:55 am
Perhaps you could write a script called "led" or something and use "led 1 on" and "led 1 off"?
Posts: 2513
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by drewibbo » Thu Jun 27, 2013 6:53 am
To elaborate on rpdom's post. You can make a script and include the following at the beginning:

Code: Select all
redon= "gpio write 1 1"
redoff= "gpio write 1 0"
greenon= "gpio write 2 1"
greenoff= "gpio write 2 0"


You can then use them in your script to quickly turn them on and off:

Code: Select all
$redon
$greenon
sleep 1
$redoff
$greenoff


It doesn't save much time coding but is an easy way to recognise it in a long script. :D

Andy
Pi Pi Pi...
User avatar
Posts: 35
Joined: Tue Feb 26, 2013 11:54 am
Location: Worthing, UK