Skip to content

Commit 6d7c926

Browse files
committed
done
1 parent b95535a commit 6d7c926

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
/*
22
* @name 通过 WebJack 读取 Arduino 传感器数据
3-
* @description WebJack 是使用音频从 Arduino(和其他来源)
3+
* @description WebJack 是使用音频从 Arduino(和其他来源)
44
* 读取数据的方式 -- 它基本上将 Arduino 变成了音频调制解调器。
5-
*
5+
*
66
* https://github.com/publiclab/webjack
7-
*
7+
*
88
* 注: WebJack 和 p5-webjack 库必须以以下方式添加到 index.html:
99
* <pre><code class="language-markup">&lt;script src="https://webjack.io/dist/webjack.js">&lt;/script></code></pre>
1010
* <pre><code class="language-markup">&lt;script src="https://jywarren.github.io/p5-webjack/lib.js">&lt;/script></code></pre>
11-
*
11+
*
1212
* 实例: https://editor.p5js.org/jywarren/sketches/rkztwSt8M
13-
*
13+
*
1414
* 测试音频: https://www.youtube.com/watch?v=GtJW1Dlt3cg
1515
* 将此草图加载到 Arduino:
1616
* https://create.arduino.cc/editor/jywarren/023158d8-be51-4c78-99ff-36c63126b554/preview
17-
* Arduino will output audio from pin 3 + ground. 请使用使用麦克风或音频线。
17+
* 从引脚 3 + 地引脚(GND)输出音频。请使用使用麦克风或音频线。
1818
*/
1919

2020
function setup() {
2121
createCanvas(400, 400);
2222
noStroke();
23-
fill('#ff00aa22');
23+
fill("#ff00aa22");
2424
receiveSensorData(handleData);
2525
}
2626

2727
function handleData(data) {
28-
29-
console.log(data); // 打出数据
28+
console.log(data); // 打出数据
3029
// data[0] 是第一个值, data[1] 是第二个, 以此类推.
3130

3231
// 绘制! 参考 http://p5js.org/reference/
33-
background('#ddd');
32+
background("#ddd");
3433
ellipse(100, 200, data[0] + 10, data[0] + 10);
35-
3634
}

0 commit comments

Comments
 (0)