-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
98 lines (83 loc) · 2.76 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Light Control Panel</title>
</head>
<body style="text-align:center;">
<h1 style="color:green;">
Light Control Panel
</h1>
<?php
$red = $green = $blue = 0;
if(isset($_POST['ON'])) {
//echo "ON";
shell_exec ("sudo killall python");
shell_exec ("sudo python /home/pi/lightWebsite/neopixeltest.py True");
}
if(isset($_POST['OFF'])) {
//echo "OFF";
shell_exec ("sudo killall python");
$red = $green = $blue = 0;
}
if(isset($_POST['RED'])) {
//echo "RED";
shell_exec ("sudo killall python");
$green = $blue = 0;
$red = 255;
}
if(isset($_POST['GREEN'])) {
//echo "GREEN";
shell_exec ("sudo killall python");
$red = $blue = 0;
$green = 255;
}
if(isset($_POST['BLUE'])) {
//echo "BLUE";
shell_exec ("sudo killall python");
$red = $green = 0;
$blue = 255;
}
if(isset($_POST['WHITE'])) {
//echo "WHITE";
shell_exec ("sudo killall python");
$red = $green = $blue = 255;
}
?>
<form method="post">
<input type="submit" name="ON"
value="ON"/>
<input type="submit" name="OFF"
value="OFF"/>
<input type="submit" name="RED"
value="RED"/>
<input type="submit" name="GREEN"
value="GREEN"/>
<input type="submit" name="BLUE"
value="BLUE"/>
<input type="submit" name="WHITE"
value="WHITE"/>
</form>
<h3>Enter RGB Values</h3>
<a href="https://www.google.com/search?q=rgb+color+picker&oq=rgb+color+picker&aqs=chrome.0.0l8.1775j0j7&sourceid=chrome&ie=UTF-8" target="_blank">RBG color picker</a>
<?php
if(isset($_POST['submit'])){
$red = $_POST["red1"];
$green = $_POST["green1"];
$blue = $_POST["blue1"];
}
shell_exec ("sudo python /home/pi/lightWebsite/neopixeltest.py True '".$green."' '".$red."' '".$blue."'");
?>
<form method="post">
RED: <input type="int" name="red1"
value="<?php echo $red;?>"><br>
GREEN: <input type="int" name="green1"
value="<?php echo $green;?>"><br>
BLUE: <input type="int" name="blue1"
value="<?php echo $blue;?>"><br>
<input type="submit"
value="submit" name="submit">
</form>
</body>
</html>
<!--shell_exec ("sudo python /home/pi/lightWebsite/neopixeltest.py")-->