-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (70 loc) · 2.34 KB
/
index.html
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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<script type="text/javascript">
function gettemp()
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", '/Action/ActionType="GetTemperature"', true );
xmlHttp.onload = function (e)
{
if (xmlHttp.readyState === 4)
{
if (xmlHttp.status === 200)
{
document.getElementById('temp_label').innerHTML = xmlHttp.responseText;
setTimeout(gettemp,500);
}
}
};
xmlHttp.send(null);
}
function getmot()
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", '/Action/ActionType="GetPinLevel"&GpioID="10"', true );
xmlHttp.onload = function (e)
{
if (xmlHttp.readyState === 4)
{
if (xmlHttp.status === 200)
{
document.getElementById('motion_sensor_label').innerHTML = xmlHttp.responseText;
setTimeout(getmot,100);
}
}
};
xmlHttp.send(null);
}
function proceed()
{
gettemp();
getmot();
}
function on_gpio1()
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", '/Action/ActionType="SetHiLevelPin"&GpioID="17"', true );
xmlHttp.send(null);
}
function off_gpio1()
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", '/Action/ActionType="SetLowLevelPin"&GpioID="17"', true );
xmlHttp.send(null);
}
</SCRIPT>
<body onload="proceed()">
<font size="13">
<p id='temp_label'></p>
<p id='motion_sensor_label'></p>
</font>
<button id="on_gpio1" onclick="on_gpio1()">Turn on Gpio1</button>
<button id="off_gpio1" onclick="off_gpio1()">Turn off Gpio1</button>
</body>
</html>