File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
src/data/examples/zh-Hans/10_Interaction Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
* @name 通过 WebJack 读取 Arduino 传感器数据
3
- * @description WebJack 是使用音频从 Arduino(和其他来源)
3
+ * @description WebJack 是使用音频从 Arduino(和其他来源)
4
4
* 读取数据的方式 -- 它基本上将 Arduino 变成了音频调制解调器。
5
- *
5
+ *
6
6
* https://github.com/publiclab/webjack
7
- *
7
+ *
8
8
* 注: WebJack 和 p5-webjack 库必须以以下方式添加到 index.html:
9
9
* <pre><code class="language-markup"><script src="https://webjack.io/dist/webjack.js"></script></code></pre>
10
10
* <pre><code class="language-markup"><script src="https://jywarren.github.io/p5-webjack/lib.js"></script></code></pre>
11
- *
11
+ *
12
12
* 实例: https://editor.p5js.org/jywarren/sketches/rkztwSt8M
13
- *
13
+ *
14
14
* 测试音频: https://www.youtube.com/watch?v=GtJW1Dlt3cg
15
15
* 将此草图加载到 Arduino:
16
16
* https://create.arduino.cc/editor/jywarren/023158d8-be51-4c78-99ff-36c63126b554/preview
17
- * Arduino will output audio from pin 3 + ground. 请使用使用麦克风或音频线。
17
+ * 从引脚 3 + 地引脚(GND)输出音频。 请使用使用麦克风或音频线。
18
18
*/
19
19
20
20
function setup ( ) {
21
21
createCanvas ( 400 , 400 ) ;
22
22
noStroke ( ) ;
23
- fill ( ' #ff00aa22' ) ;
23
+ fill ( " #ff00aa22" ) ;
24
24
receiveSensorData ( handleData ) ;
25
25
}
26
26
27
27
function handleData ( data ) {
28
-
29
- console . log ( data ) ; // 打出数据
28
+ console . log ( data ) ; // 打出数据
30
29
// data[0] 是第一个值, data[1] 是第二个, 以此类推.
31
30
32
31
// 绘制! 参考 http://p5js.org/reference/
33
- background ( ' #ddd' ) ;
32
+ background ( " #ddd" ) ;
34
33
ellipse ( 100 , 200 , data [ 0 ] + 10 , data [ 0 ] + 10 ) ;
35
-
36
34
}
You can’t perform that action at this time.
0 commit comments