-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwa-g3.html
52 lines (44 loc) · 1.21 KB
/
wa-g3.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
<html>
<head>
<script type="text/javascript" src="../webduino-js/src/module/G3.js"></script>
</head>
<body>
<script>
(function() {
var proto = Object.create(HTMLElement.prototype, {
rx: {
get: function() {
return this.getAttribute('rx');
},
set: function(val) {
this.setAttribute('rx', val);
}
},
tx: {
get: function() {
return this.getAttribute('tx');
},
set: function(val) {
this.setAttribute('tx', val);
}
}
});
proto.init_ = function(board) {
var G3 = webduino.module.G3;
this.g3 = new G3(board,
board.getDigitalPin(this.rx),
board.getDigitalPin(this.tx));
};
proto.read = function(callback, interval) {
this.g3.read(callback, interval);
}
proto.stopRead = function() {
this.g3.stopRead();
}
document.registerElement('wa-g3', {
prototype: proto
});
})();
</script>
</body>
</html>