-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathwa-dht.html
More file actions
42 lines (34 loc) · 804 Bytes
/
wa-dht.html
File metadata and controls
42 lines (34 loc) · 804 Bytes
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
<html>
<head>
<script type="text/javascript" src="../webduino-js/src/module/Dht.js"></script>
</head>
<body>
<script>
(function() {
var proto = Object.create(HTMLElement.prototype, {
pin: {
get: function() {
return this.getAttribute('pin');
},
set: function(val) {
this.setAttribute('pin', val);
}
}
});
proto.init_ = function(board) {
var Dht = webduino.module.Dht;
this.dht = new Dht(board, board.getDigitalPin(this.pin));
};
proto.read = function(callback, interval) {
this.dht.read(callback, interval);
}
proto.stopRead = function() {
this.dht.stopRead();
}
document.registerElement('wa-dht', {
prototype: proto
});
})();
</script>
</body>
</html>