-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
106 lines (103 loc) · 4.55 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html lang="en">
<head>
<style>
*{
margin:0px;
padding:0px;
}
.apply{
background-color:#1A5276;
}
</style>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Home Automation</title>
<link rel="icon" type="image/png" href="/images/hauto.png" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
type="text/javascript"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body class="apply">
<div class="row" style="background-color:#34495E;height:60px;">
<div class="col-md-3 col-xs-3">
<img class="img-responsive" src="/images/hauto.png" style="width:54px;height:56px;">
</div>
<div class="col-md-6 col-xs-7"style="padding-left:2px;" >
<h3 style="color:#b9ff46;font-size:20px;"><center>Home Automation </center></h3>
</div>
<div class="col-md-3 col-xs-2">
<a href="https://github.com/raj808569/homeautomationIOT">
<img src="/images/github.png" style="width:54px;float:right;height:56px;">
</a>
</div>
</div>
<div class="row" style="padding-top:52px;">
<div class="col-md-4 col-xs-4">
<center><img id="light1" src="/images/whitelight.png" class="img-responsive" style="max-width:50%;"></center>
<center><div class="caption">
<h3 style="color:#b9ff46;">Light 1</h3>
<p><a href="#" id="light1on" class="btn btn-primary" role="button">Light On</a> <a href="#" id="light1off" class="btn btn-default" role="button">Light Off</a></p>
</div></center>
</div>
<div class="col-md-4 col-xs-4">
<center><img id="fan1" src="/images/fan.png" class="img-responsive" style="max-width:50%;"></center>
<center><div class="caption">
<h3 style="color:#b9ff46;">Fan 1</h3>
<p><a href="#" id="fan1on" class="btn btn-primary" role="button">Fan On</a> <a href="#" id="fan1off" class="btn btn-default" role="button">Fan Off</a></p>
</div></center>
</div>
<div class="col-md-4 col-xs-4">
<center><img id="light2" src="/images/whitelight.png" class="img-responsive" style="max-width:50%;"></center>
<center><div class="caption">
<h3 style="color:#b9ff46;">Light 2</h3>
<p><a href="#" id="light2on" class="btn btn-primary" role="button">Light On</a> <a href="#" id="light2off" class="btn btn-default" role="button">Light Off</a></p>
</div></center>
</div>
</div>
</body>
<script>
$(function(){
var socket = io.connect();
$("#light1on").click(function(){
$("#light1").attr("src","/images/yellowlight.png");
socket.emit('light1',1);
});
socket.on('light1done',function(data){
data.led.writeSync(data.value);
});
$("#light1off").click(function(){
$("#light1").attr("src","/images/whitelight.png");
socket.emit('light1off',0);
});
socket.on('light1offdone',function(data){alert(data.value);
data.led.writeSync(data.value);
});
$("#fan1on").click(function(){
$("#fan1").attr("src","/images/fan.gif");
socket.emit('fan1',1);
});
$("#fan1off").click(function(){
$("#fan1").attr("src","/images/fan.png");
socket.emit('fan1off',1);
});
$("#light2on").click(function(){
$("#light2").attr("src","/images/yellowlight.png");
socket.emit('light2',1);
});
socket.on('light2done',function(data){
data.led.writeSync(data.value);
});
$("#light2off").click(function(){
$("#light2").attr("src","/images/whitelight.png");
socket.emit('light2off',0);
});
socket.on('light2offdone',function(data){
data.led.writeSync(data.value);
});
});
</script>
</html>