├── LICENSE
├── README.md
├── bower.json
├── demo
├── adxl345.html
├── angularjs
│ ├── js
│ │ └── ledController.js
│ └── led.html
├── barcode.html
├── buzzer.html
├── dht.html
├── g3.html
├── hx711.html
├── irled.html
├── irrecv.html
├── jigglypuff
│ ├── jigglypuff.html
│ ├── jigglypuff.mp3
│ ├── sing.gif
│ └── stand.jpg
├── joystick.html
├── led.html
├── max7219.html
├── mq2.html
├── oled.html
├── photocell.html
├── pir.html
├── pot.html
├── push.html
├── relay.html
├── rfid.html
├── rgbled.html
├── servo.html
├── shock.html
├── soil.html
├── sound.html
├── stepper.html
├── tilt.html
└── ultrasonic.html
├── img
└── stepper.jpg
├── js
├── wa.event.js
└── wa.js
├── wa-adxl345.html
├── wa-barcode.html
├── wa-button.html
├── wa-buzzer.html
├── wa-dht.html
├── wa-g3.html
├── wa-hx711.html
├── wa-irled.html
├── wa-irrecv.html
├── wa-joystick.html
├── wa-led.html
├── wa-max7219.html
├── wa-mq2.html
├── wa-photocell.html
├── wa-pir.html
├── wa-pot.html
├── wa-relay.html
├── wa-rfid.html
├── wa-rgbled.html
├── wa-servo.html
├── wa-shock.html
├── wa-soil.html
├── wa-sound.html
├── wa-ssd1306.html
├── wa-stepper.html
├── wa-tilt.html
├── wa-ultrasonic.html
└── web-arduino.html
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 webduino.io. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # webduino
2 |
3 | Web components for Webduino
4 |
5 | ## Installation
6 |
7 | ```Shell
8 | $ bower install webduino
9 | ```
10 |
11 | ## Usage
12 |
13 | Insert webduino web-components and polyfill:
14 |
15 | ```html
16 |
17 |
18 |
19 | ```
20 |
21 | Use it in your html:
22 |
23 | ```html
24 |
25 |
26 |
27 | ```
28 |
29 | Control it with javascript:
30 |
31 | ```javascript
32 | window.addEventListener('WebComponentsReady', function() {
33 | var board = document.getElementById('board'),
34 | led = document.getElementById('led');
35 |
36 | board.on('ready', function () {
37 | led.on();
38 | });
39 | });
40 | ```
41 |
42 | ## API
43 |
44 | _(coming soon...)_
45 |
46 | ## See Also
47 |
48 | [webduino-js](https://github.com/webduinoio/webduino-js) (The javascript core that powers webduino)
49 |
50 | ## License
51 |
52 | This project is licensed under MIT, please see [LICENSE](LICENSE) for more information.
53 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webduino",
3 | "description": "Web components for Webduino",
4 | "repository": "https://github.com/webduinoio/webduino.git",
5 | "homepage": "http://webduino.io",
6 | "keywords": ["arduino", "webduino", "web-components"],
7 | "license": "MIT",
8 | "dependencies": {
9 | "webcomponentsjs": "0.x",
10 | "webduino-js": "dist"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/demo/adxl345.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 三軸(adxl345)
8 |
9 |
10 |
11 |
12 |
70 |
71 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
164 | led pin : 10
165 | adxl - gnd, vcc, sda pin: A4, scl pin: A5
166 | 說明:
167 |
1. roll(繞 x 轉動), pitch(繞 y 轉動),感應器目標軸(x or y)箭頭朝前,目標軸的逆時針轉動會得到正值
168 |
2. -180 < roll < 180, -90 < pitch < 90
169 |
2. 屬性(baseaxis),決定修正的向量以那個為準,可輸入值為 x,y,z,預設為 z,表示將 adxl345 平放,正面朝上,此時 z 軸會得到接近 1g(m/s^2),x, y 為 0g。
170 |
3. 屬性(sensitive),敏感度。當感測器偵測到的數值,變化要超過敏感度,才會拋出資料。
171 |
172 |
173 |
174 |
點擊燈炮,啟動三軸加速度計
175 |
176 |

177 |

178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
^
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
264 |
265 |
266 |
267 |
--------------------------------------------------------------------------------
/demo/angularjs/js/ledController.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ledExample', [])
4 | .controller('ledController', ['$scope', function ($scope) {
5 |
6 | $scope.stateModel = [{
7 | label: 'on',
8 | value: 'on'
9 | }, {
10 | label: 'off',
11 | value: 'off'
12 | }];
13 |
14 | $scope.state = $scope.stateModel[1];
15 |
16 | $scope.toggle = function () {
17 | var state = $scope.state;
18 | if (state.value !== 'on') {
19 | $scope.state = $scope.stateModel[0];
20 | } else {
21 | $scope.state = $scope.stateModel[1];
22 | }
23 | };
24 | }]);
25 |
--------------------------------------------------------------------------------
/demo/angularjs/led.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | LED:
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/demo/barcode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Barcode Scanner
8 |
9 |
10 |
11 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
81 | 說明:
82 |
83 |
點擊燈炮,啟動接收Barcode資料
84 |
85 |

86 |

87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/demo/buzzer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/demo/dht.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Detect humidity and temperature
8 |
9 |
10 |
11 |
12 |
13 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 | 需接地及5V電源, DHT pin : 10
49 | 使用溫溼度感應,偵測現場溫溼度。
50 | none
51 |
52 |
53 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/demo/g3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Detect humidity and temperature
8 |
9 |
10 |
11 |
12 |
13 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 | 需接地及5V電源, G3 rx: 2 , tx: 3
49 | 使用G3傳感器,偵測現場PM25 , PM10
50 | none
51 |
52 |
53 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/demo/hx711.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 電子秤(hx711)
8 |
9 |
10 |
11 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
81 | 說明:
82 |
等顯示0g後,季可開始測量物體重量
83 |
84 |
85 |
86 |
點擊燈炮,啟動電子秤
87 |
88 |

89 |

90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/demo/irled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 紅外線發射(irled)
8 |
9 |
10 |
11 |
12 |
13 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
72 | led pin : 10
73 | irled pin : 9 (固定)
74 | 電視開關訊號 : 20df10ef
75 | 點擊圖示,燈泡亮起時,發出紅外線訊號
76 |
77 |

78 |

79 |
80 |
81 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/demo/irrecv.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 紅外線接收(irrecv)
8 |
9 |
10 |
11 |
12 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
80 | led pin : 9
81 | irrecv pin : 10
82 | 說明:
83 |
紅外線接收器面向自已,由左自右腳位依序為 Vout(讀取紅外線訊號),GND,VCC。
84 |
85 | 點擊燈炮,啟動紅外線接收
86 |
87 |

88 |

89 |
90 |
91 |
92 |
93 |
94 |
95 |
184 |
185 |
186 |
187 |
--------------------------------------------------------------------------------
/demo/jigglypuff/jigglypuff.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Jigglypuff
7 |
8 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
74 |
75 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |

103 |

104 |
105 |
106 |
206 |
207 |
208 |
209 |
--------------------------------------------------------------------------------
/demo/jigglypuff/jigglypuff.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webduinoio/webduino/82ed174cddd8887238f2a056e084c3262ff3a92e/demo/jigglypuff/jigglypuff.mp3
--------------------------------------------------------------------------------
/demo/jigglypuff/sing.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webduinoio/webduino/82ed174cddd8887238f2a056e084c3262ff3a92e/demo/jigglypuff/sing.gif
--------------------------------------------------------------------------------
/demo/jigglypuff/stand.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webduinoio/webduino/82ed174cddd8887238f2a056e084c3262ff3a92e/demo/jigglypuff/stand.jpg
--------------------------------------------------------------------------------
/demo/joystick.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 搖捍(Joystick)
8 |
9 |
10 |
11 |
12 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
94 | led pin : 9
95 | joystick, gnd, vcc, vrx analog pin : 4, vry analog pin : 5, sw pin : 10
96 | 說明:
97 |
x, y 軸的值介於 0 ~ 1 之間,初始值約 0.5 上下。
98 |
z 為按鈕,值為 0, 1,按下時值為 1。
99 |
100 |
101 |
102 |
點擊燈炮,開始接收搖捍發出的訊息
103 |
104 |

105 |

106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/demo/led.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | LED
8 |
9 |
10 |
11 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
68 |
69 |
Use the buttons below to switch the LED to on or off.
70 |
71 |
72 |
73 |
74 |
75 |
Set blink interval and click button to start blinking.
76 |
77 |
78 |
79 |
80 |
Change led state to on/off/blink (1000 as blink interval).
81 |
82 |
83 |
84 | led pin : 10
85 | 控制 LED
86 | none
87 |
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/demo/max7219.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 點矩陣(max7219)
7 |
8 |
9 |
10 |
11 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
70 | led pin : 11
71 | max7219 din : 9, cs : 10, clk : 12
72 | 匯製代碼
73 |
74 |
81 |
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/demo/mq2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 氣體傳感器(mq2)
8 |
9 |
10 |
11 |
12 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
94 | led pin : 9
95 | mq2 analog pin : 5
96 | 說明:
97 |
值介於 0 ~ 1 之間,偵測瓦斯/煙霧的量愈多,數字愈大。
98 |
這裡的範例,使用類比腳來偵測,也可以使用數位腳的方式。
99 |
也就是 DO 接上數位腳後,採用下方被註解的程式碼。
100 |
盡量不同時使用二者,有機會掛掉。
101 |
102 |
103 |
104 |
點擊燈炮,啟動光敏電阻
105 |
106 |

107 |

108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
186 |
187 |
188 |
189 |
--------------------------------------------------------------------------------
/demo/oled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | OLED(SSD1306)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/demo/photocell.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 光敏電阻(photocell)
8 |
9 |
10 |
11 |
12 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
94 | led pin : 9
95 | photocell analog pin : 5
96 | 說明:
97 |
值介於 0 ~ 1 之間,偵測的環境愈亮,數字愈大。
98 |
99 |
100 |
101 |
點擊燈炮,啟動光敏電阻
102 |
103 |

104 |

105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/demo/pir.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | pir
8 |
9 |
10 |
11 |
12 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
50 | Led pin : 6
51 | Pir pin : 9
52 | 利用人體紅外線感應,讓 Led 亮起來。
53 | none
54 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/demo/pot.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 可變電組(pot: potentiometer)
8 |
9 |
10 |
11 |
12 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
94 | led pin : 9
95 | pot analog pin : 5
96 | 說明:
97 |
值介於 0 ~ 1 之間。
98 |
99 |
100 |
101 |
點擊燈炮,啟動可變電阻
102 |
103 |

104 |

105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/demo/push.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/demo/relay.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | relay
8 |
9 |
10 |
11 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
63 |
64 |
Use the buttons below to switch the Relay to on or off.
65 |
66 |
67 |
68 |
69 | relay pin : 10
70 | 利用繼電器,控制電燈。
71 | none
72 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/demo/rfid.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | RFID(RC522)
8 |
9 |
10 |
11 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
92 | 接線:3.3v 和 gnd 及 SDA(10), MOSI(11), MISO(12), SCK(13)
93 | 說明:
94 |
接收到訊號時,會拋出字串,訊號源離開時,會收到空字串。
95 |
96 |
97 |
98 |
點擊燈炮亮起,啟動 RFID,熄燈則關閉 RFID
99 |
100 |

101 |

102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/demo/rgbled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/demo/servo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | servo
8 |
9 |
10 |
11 |
12 |
13 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
48 |
49 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/demo/shock.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Shock
8 |
9 |
10 |
11 |
12 |
13 |
14 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 | Led pin : 6
51 | Shock pin : 10
52 | 透過震動開關發出的事件,讓 Led 亮起來。
53 | none
54 |
55 |
56 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/demo/soil.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 土壤溼度
8 |
9 |
10 |
11 |
12 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
93 | soil analog pin : 5 (A3)
94 | 說明:
95 |
值介於 0 ~ 100% 之間,數字愈大,溼度愈高。
96 |
97 |
98 |
99 |
點擊燈炮,啟動土壤溼度感測器
100 |
101 |

102 |

103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/demo/sound.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | sound
8 |
9 |
10 |
11 |
12 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
50 | Led pin : 6
51 | sound pin : 10
52 | 利用聲音感應,讓 Led 亮起來。
53 | none
54 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/demo/stepper.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 步進馬達
8 |
9 |
10 |
11 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
92 | ULN2003 達林頓晶片驅動步進馬達驅動板上的 IN1, IN2, IN3, IN4 分別接上四個數位腳位 8, 9, 10, 11
93 | stepperNumber:設定馬達的編號 0~5
94 | interface:馬達的相數
95 | stepsPerRevolution:馬達轉一圈的步數
96 |
97 |
98 | 控制命令
99 | direction:0, 1 (CW clockwise 順時針, CCW counterclockwise 逆時針)
100 | stepNumber:轉動步數
101 | speed:步進馬達(型號28BYJ-48, 5V DC),建議 10~160 單位(0.01 rad/sec)
102 |
103 |
104 |
105 |
點擊燈炮,步進馬達會執行指令
106 |
107 |

108 |

109 |
110 |
111 |

112 |
113 |
114 |
115 |
116 |
117 |
118 |
179 |
180 |
181 |
182 |
--------------------------------------------------------------------------------
/demo/tilt.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Tilt
8 |
9 |
10 |
11 |
12 |
13 |
14 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 | Led pin : 6
51 | Tilt pin : 10
52 | 透過水銀開關發出的事件,讓 Led 亮起來。
53 | none
54 |
55 |
56 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/demo/ultrasonic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/img/stepper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/webduinoio/webduino/82ed174cddd8887238f2a056e084c3262ff3a92e/img/stepper.jpg
--------------------------------------------------------------------------------
/js/wa.event.js:
--------------------------------------------------------------------------------
1 | +(function (scope) {
2 | 'use strict';
3 |
4 | function Events() {
5 | this.eventListeners = {};
6 | };
7 |
8 | Events.prototype.on = function (eventType, handler) {
9 | var listeners = this.eventListeners;
10 |
11 | if (!listeners.hasOwnProperty(eventType)) {
12 | listeners[eventType] = [];
13 | }
14 | listeners[eventType].push(handler);
15 | };
16 |
17 | Events.prototype.off = function (eventType, handler) {
18 | var idx, listenersAry;
19 |
20 | if (eventType && handler) {
21 | listenersAry = this.eventListeners[eventType];
22 | idx = listenersAry.indexOf(handler);
23 | while(idx !== -1) {
24 | listenersAry.splice(idx, 1);
25 | idx = listenersAry.indexOf(handler);
26 | }
27 | } else if (eventType) {
28 | this.eventListeners[eventType] = [];
29 | } else {
30 | this.eventListeners = {};
31 | }
32 | };
33 |
34 | Events.prototype.emit = function (eventType, args, self) {
35 | var listeners = this.eventListeners;
36 | self = self || null;
37 |
38 | if (listeners.hasOwnProperty(eventType)) {
39 | for (var i = 0, len = listeners[eventType].length; i < len; ++i) {
40 | try {
41 | args instanceof Array || (args = [args]);
42 | listeners[eventType][i].apply(self, args);
43 | } catch (e) {
44 | if (console && console.error) {
45 | console.error(e);
46 | }
47 | }
48 | }
49 | }
50 | };
51 |
52 | scope.webduino && (scope.webduino.Events = Events);
53 |
54 | })(this);
55 |
--------------------------------------------------------------------------------
/js/wa.js:
--------------------------------------------------------------------------------
1 | +(function (scope) {
2 | !scope.webduino && (scope.webduino = {});
3 | })(this);
--------------------------------------------------------------------------------
/wa-adxl345.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/wa-barcode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/wa-button.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/wa-buzzer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/wa-dht.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/wa-g3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/wa-hx711.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/wa-irled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/wa-irrecv.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/wa-joystick.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/wa-led.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/wa-max7219.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/wa-mq2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/wa-photocell.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/wa-pir.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/wa-pot.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/wa-relay.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/wa-rfid.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/wa-rgbled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/wa-servo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/wa-shock.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/wa-soil.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/wa-sound.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/wa-ssd1306.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/wa-stepper.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/wa-tilt.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/wa-ultrasonic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/web-arduino.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
186 |
187 |
188 |
189 |
--------------------------------------------------------------------------------