Page 1 of 2
How to control your LED
Posted: 03 Feb 2007, 15:59
by John W
It's pretty simple.
Just write this in the terminal.
On: /etc/init.d/led_on
Off: /etc/init.d/led_off
Blink: /etc/init.d/led_blink
// John

Posted: 19 Feb 2007, 18:00
by johannes
Nice!
Just to check, would you mind if I snatch this idea? We are right now working on a collection of articles (how-to's) and this would make a great contribution.
Thanks,
Posted: 20 Feb 2007, 09:53
by John W
Yeah, good idea.
I found this and was thinking of the LED on the Bubba.
http://wiki.gudinna.com/202
Does anybody feel for making a PHP-script that flashes the front LED everytime somebody visits your site.
I think that would be cool.
// John
Posted: 22 Feb 2007, 09:15
by Takiko
another cool idea would be to make it blink when someone is logged on through ssh or something. ^
Posted: 06 Mar 2007, 21:46
by TheEagleCD
I'd find it useful if the LED would start blinking for an adjustable amount of time once a download is finished. Then I'd immediatly know when I can get my next dose of DL.TV without having to check the web-interface every 5 minutes.
Cheers,
Christoph
Posted: 08 Mar 2007, 09:25
by Filip
I have made a solution to control the led with a simple PHP-script!
In the command line
And type the password ('excito' by default)
Then type:
And add the following line to the end of the file:
ALL ALL=NOPASSWD:/etc/init.d/led_blink, /etc/init.d/led_on, /etc/init.d/led_off
Save it and exit.
That will make it possible for everyone to execute the command to control the led. Now any user may execute the command from the command line:
sudo /etc/init.d/led_blink
This is then used in any PHP-script to control the led
Code: Select all
<?php
exec('sudo /etc/init.d/led_blink');
?>
It may also be combined like:
Code: Select all
<?php
exec('sudo /etc/init.d/led_blink; sleep 5; sudo /etc/init.d/led_off');
?>
Now it's up to someone else to enhance the feature even more!
Posted: 08 Mar 2007, 12:18
by John W
Nice!
I made a simple php-script which you can controll your led with.
Here's the code.
Code: Select all
<a href=?led=on>On</a><br />
<a href=?led=off>Off</a><br />
<a href=?led=blink>Blink</a><br />
<?php
if ($_GET['led'] == "on")
{
exec("sudo /etc/init.d/led_on");
}
if ($_GET['led'] == "off")
{
exec("sudo /etc/init.d/led_off");
}
if ($_GET['led'] == "blink")
{
exec("sudo /etc/init.d/led_blink");
}
?>
// John W

Posted: 08 Mar 2007, 14:12
by msx
lol

i tryed it, did you see the led blinking?

Posted: 08 Mar 2007, 14:25
by John W
I saw it blinking a couple of minutes ago.

Posted: 08 Mar 2007, 14:44
by msx
so the next step is making a script that takes a string and outputs it on the led using morse code

Posted: 08 Mar 2007, 15:02
by Filip
The following command takes 19 seconds to execute before it prints "Hello world!". Shouldn't it be possible to continue directly without having to wait until the execution is ready?
Code: Select all
<?php
exec("sudo etc/init.d/led_on; sleep 5; etc/init.d/led_off; sleep 5; etc/init.d/led_on; sleep 1; etc/init.d/led_off; sleep 3; etc/init.d/led_on; sleep 5; etc/init.d/led_off;");
print "Hello World!";
?>
If there is a way to continue, the possibilities are endless of what you can do with the LED! For example sending morse code!
Posted: 08 Mar 2007, 16:01
by John W
Posted: 08 Mar 2007, 16:06
by tor
Cool stuff
I have an embryo to a short article on attaching a USB Display to Bubba. That would be cool to use for letting web visitors leave messages to you in your living room... interested?
/Tor
Posted: 08 Mar 2007, 16:25
by John W
tor wrote:Cool stuff
I have an embryo to a short article on attaching a USB Display to Bubba. That would be cool to use for letting web visitors leave messages to you in your living room... interested?
/Tor
Offcourse we are!
Sounds interesting.
// John W
Posted: 11 Mar 2007, 13:09
by John W
I made some progress today.

The LED will stay lit for 5 seconds. Then it will be turned off. And you don't have to wait for the process to finish.
blink.php
Code: Select all
<a href=?led=blink>Blink</a>
<?php
if ($_GET['led'] == "blink")
{
exec("sudo /etc/init.d/led_mod > /dev/null 2>&1 &");
}
?>
led_mod
Code: Select all
#! /bin/sh
/usr/sbin/gpioapp on
sleep 5
/usr/sbin/gpioapp off
// John W