-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
73 lines (59 loc) · 1.18 KB
/
functions.php
File metadata and controls
73 lines (59 loc) · 1.18 KB
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
<?php
function on($pin)
{
shell_exec("/usr/local/bin/gpio -g write ".$pin." 1");
}
function off($pin)
{
shell_exec("/usr/local/bin/gpio -g write ".$pin." 0");
}
function set($pin)
{
shell_exec("/usr/local/bin/gpio -g mode ".$pin." out");
}
function pwm_set($pin)
{
shell_exec("/usr/local/bin/gpio -g mode ".$pin." pwm");
}
function pwm_on($pin, $wartosc)
{
shell_exec("/usr/local/bin/gpio -g pwm ".$pin." ".$wartosc);
}
function pwm_off($pin, $wartosc)
{
shell_exec("/usr/local/bin/gpio -g pwm ".$pin." ".$wartosc);
}
function motor($pin, $delay)
{
shell_exec("python motor.py ".$pin." ".$delay." > /dev/null 2>&1 &");
}
function pwm_bright($pin, $bright)
{
shell_exec("/usr/local/bin/gpio -g pwm ".$pin." ".$bright);
}
function temp($jednostka)
{
$temp = shell_exec("python temp.py ".$jednostka);
return $temp;
}
function blink()
{
shell_exec("python blink.py > /dev/null 2>&1 &");
}
function kill_blink()
{
shell_exec("pkill -f blink.py");
}
function check($pin)
{
$status = shell_exec("/usr/local/bin/gpio -g read ".$pin);
if ($status == 1)
{
echo "ON";
}
else if ($status == 0)
{
echo "OFF";
}
}
?>