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 to control your LED
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
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
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
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
-
- Posts: 46
- Joined: 27 Feb 2007, 16:44
- Location: Austria
- Contact:
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
It may also be combined like:
Now it's up to someone else to enhance the feature even more!
In the command line
Code: Select all
su
Then type:
Code: Select all
visudo
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');
?>
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!
Nice!
I made a simple php-script which you can controll your led with.
Here's the code.
// John W
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");
}
?>
Last edited by John W on 22 Mar 2007, 19:56, edited 1 time in total.
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?
If there is a way to continue, the possibilities are endless of what you can do with the LED! For example sending morse code!
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!";
?>
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
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
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
led_mod
// John W
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 &");
}
?>
Code: Select all
#! /bin/sh
/usr/sbin/gpioapp on
sleep 5
/usr/sbin/gpioapp off