New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

How to control your LED

How are you using your Bubba? Got ideas for a cool modification? Share!
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

How to control your LED

Post by John W »

It's pretty simple. :P

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 :wink:
johannes
Posts: 1470
Joined: 31 Dec 2006, 07:12
Location: Sweden
Contact:

Post 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. :D

Thanks,
/Johannes (Excito co-founder a long time ago, but now I'm just Johannes)
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post 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. :P

// John
Takiko
Posts: 1
Joined: 20 Feb 2007, 18:03

Post by Takiko »

another cool idea would be to make it blink when someone is logged on through ssh or something. ^
TheEagleCD
Posts: 46
Joined: 27 Feb 2007, 16:44
Location: Austria
Contact:

Post 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
Bubba, I'm lovin' it
Filip
Posts: 30
Joined: 06 Feb 2007, 12:27
Location: Lund, Sweden

Post by Filip »

I have made a solution to control the led with a simple PHP-script!

In the command line

Code: Select all

su
And type the password ('excito' by default)

Then type:

Code: Select all

visudo
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!
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post 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 :)
Last edited by John W on 22 Mar 2007, 19:56, edited 1 time in total.
msx
Posts: 106
Joined: 13 Jan 2007, 06:03
Location: Venice
Contact:

Post by msx »

lol :P
i tryed it, did you see the led blinking? :mrgreen:
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post by John W »

I saw it blinking a couple of minutes ago. :roll:
msx
Posts: 106
Joined: 13 Jan 2007, 06:03
Location: Venice
Contact:

Post by msx »

so the next step is making a script that takes a string and outputs it on the led using morse code :)
Filip
Posts: 30
Joined: 06 Feb 2007, 12:27
Location: Lund, Sweden

Post 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!
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post by John W »

tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Post 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
Co-founder OpenProducts and Ex Excito Developer
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post 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
John W
Posts: 62
Joined: 17 Jan 2007, 11:47

Post by John W »

I made some progress today. :P
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
Locked