-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled.php
36 lines (34 loc) · 1.05 KB
/
led.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head><title>BeagleBone LED Controller</title></head>
<?php
$cmd = $_SERVER['PHP_SELF'];
if (isset($_POST['led'])){
if ($_POST['command']=="on")
$command = "default-on";
else if ($_POST['command']=="off")
$command = "none";
else
$command = "timer";
shell_exec("echo ".$command." > /sys/class/leds/beaglebone:green:usr".$_POST['led']."/trigger");
$stat = shell_exec("cat /sys/class/leds/beaglebone:green:usr".$_POST['led']."/trigger");
echo "status: ".$stat."<br><br><br><hr>";
}
?>
<body>
<h1>BeagleBone LED Controller</h1>
<form action="<?php $cmd;?>" method="POST">
<div>LED
<select name="led">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>Status:
<input type="radio" name="command" value="on" checked/> On
<input type="radio" name="command" value="off"/> Off
<input type="radio" name="command" value="flash"/> Flash
<input type="checkbox" name="status" checked/> Display Status </div>
<input type="submit" value="Execute Command" />
</div>
</form>
</body></html>