-
Notifications
You must be signed in to change notification settings - Fork 0
/
lampuiot.php
30 lines (30 loc) · 1.11 KB
/
lampuiot.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
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Lampu IOT</title>
</head>
<body>
LED Control:
<form method="get" action="lampuiot.php">
<input type="submit" value="AUTO" name="auto">
<input type="submit" value="ON" name="on">
<input type="submit" value="OFF" name="off">
</form>
<?php
if(isset($_GET['auto'])){
shell_exec("sudo python /home/pi/iotprojects/lampuiot/led_auto_ldr.py > /dev/null 2>/dev/null &");
echo "Lampu diatur otomatis oleh sensor";
}
else if(isset($_GET['on'])){
shell_exec("sudo pkill -f led_auto_ldr.py");
shell_exec("sudo python /home/pi/iotprojects/lampuiot/led_on.py");
echo "Lampu hidup";
}
else if(isset($_GET['off'])){
shell_exec("sudo pkill -f led_auto_ldr.py");
shell_exec("sudo python /home/pi/iotprojects/lampuiot/led_off.py");
echo "Lampu mati";
}
?>
</body>
</html>