Skip to content

Commit

Permalink
归档 Webduino 大陆版首页的文档内容
Browse files Browse the repository at this point in the history
  • Loading branch information
junhuanchen committed Jun 5, 2019
1 parent 53a8d57 commit ba2e583
Show file tree
Hide file tree
Showing 147 changed files with 522 additions and 14 deletions.
49 changes: 49 additions & 0 deletions source/bpi-web/advanced/blockly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 认识 Webduino Blockly Bit

Webduino Blockly Bit 体验版是 Webduino 所研发出来的图像化编辑工具,采用 Google Blockly 设计而成,提供虚实整合、程序积木、远程操控的环境,可尽情体验物联网的使用情境与操作感受, 快速实现各式各样的创意。

打开:[Webduino Blockly Bit 体验版](https://webduino.com.cn/link.html?lang=zh-hans&type=blockly)

> 更多 Webduino Blockly 功能请参考:[Webduino Blockly 基本操作](https://tutorials.webduino.io/zh-tw/docs/basic/blockly/blockly-tutorial-01.html)[Webduino Blockly 特殊功能](https://tutorials.webduino.io/zh-tw/docs/basic/blockly/blockly-tutorial-02.html)[连动多块开发板](https://tutorials.webduino.io/zh-tw/docs/basic/blockly/multi-board.html)
## 工具接口说明

Webduino Blockly 的接口主要分成三个部分,第一个部分是左边与左上方的选单列,里头有「程序积木」与「JavaScript」两个互相切换的页签,右上方依序为「产生 QRCode」、「查看装置状态」、「网页互动测试」 、「Webduino Bit 仿真器」、「删除所有积木」、「存盘并产生链接」和「执行」。

![](img/tutorials/zh_cn/blockly-01.jpg)

## 控制 Webduino Bit 开发板

ebduino Blockly Bit 目前可以 Wi-Fi 和 WebSocket 操控,如果没有实体开发板,亦可透过「仿真器」的方式操控。

![](img/tutorials/zh_cn/blockly-02.jpg)

注意,若要使用 WebSocket,**网址必须为 http,且端口号须为 8080**

![](img/tutorials/zh_cn/blockly-08.jpg)

## 储存盘案

当我们编辑完之后,可以点选 Webduino Blockly 右上方的「链接」图标,会产生一组链接网址,这组链接网址代表的是当前画面,只要把这组网址记到浏览器的「我的最爱」或「书签」内,下次再打开就会出现一模一样的画面了。

![](img/tutorials/zh_cn/blockly-07.jpg)

## 在线 Webduino Bit 仿真器

打开 Webduino Blockly Bit 体验版后,画面上会自动打开仿真器,仿真器里包含一块虚拟的 Bit 开发板,程序执行后,开发板上的 Webduino logo 会变成绿色,同时下方出现灯泡与火焰的虚拟元素,如果有使用「 光敏电阻」,则可以透过灯泡元素进行互动,若有使用「温敏电阻」,则可以透过火焰元素进行互动。

![](img/tutorials/zh_cn/blockly-03.jpg)

## 网页互动区

Webduino Blockly 内嵌网页模板,点选网页互动测试的按钮,就可以从下拉选单选择这些网页模板,并透过这些网页操控物联网装置,网页模板包含:显示文字、点击灯泡、控制图片、颜色调整、按钮行为、拉霸操作、Youtube 、影像追踪、遥控器、绘制图表。

![](img/tutorials/zh_cn/blockly-04.jpg)

## 完美支持手机

Webduino Blockly 内建了 QRCode 的按钮,点选这个按钮就会产生 QRCode ,用行动装置扫描,就可以将目前「网页互动区」的网页,呈现于手机的浏览器。

![](img/tutorials/zh_cn/blockly-05.jpg)

![](img/tutorials/zh_cn/blockly-06.jpg)
53 changes: 53 additions & 0 deletions source/bpi-web/advanced/button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 按钮开关

开关常见于日常生活中,在 Webduino Bit 开发板正面的左右两侧,默认了两颗按钮开关,透过开关的操控,我们更能实作物联网的情境,甚至打造真实的游戏遥控器或智能家电的应用。

## 基本操作

打开 [Webduino Blockly Bit 体验版](https://webduino.com.cn/link.html?lang=zh-hans&type=blockly),在编辑区放入*开发板积木*, 开发板默认使用「*仿真器*」,联机到画面中「*虚拟的 Bit 开发板*」,默认 Device ID 为 「*1234*」。

> 开发板相关积木,在「*开发板*」目录下。
![](img/tutorials/zh_cn/rgbmatrix-01.jpg)

如果是使用「*实体 Bit 开发板*」,下拉选单选择「*Wi-Fi*」,并于后方字段填入开发板的 Device ID。

![](img/tutorials/zh_cn/rgbmatrix-02.jpg)

在开发板内放入两个「*设定 button 为按钮开关*」的积木,从后方按钮开关的下拉选单,可以选择按钮 A 或按钮 B,选择完成后,点选在前方设定积木的下拉选单,使用「*新变量*」将变量分别命名为 btnA 和 btnB。

> 按钮开关相关积木,在「*按钮开关*」目录下。
![](img/tutorials/zh_cn/button-01.jpg)

点选右上方的选单,打开网页互动区,下拉选单选择「*显示文字*」,左侧选单也会出现对应的积木功能。

![](img/tutorials/zh_cn/button-02.jpg)

放入「当 button 进行按下」的积木,透过下拉选单选择对应的 btnA 或 btnB,设定当按下 btnA 的时候,在网页互动区显示「按下 A」,当按下 btnB 的时候,显示「按下 B」。

> 显示积木在「*显示文字*」目录下,文字积木在「*基本功能 > 文字*」目录下。
![](img/tutorials/zh_cn/button-03.jpg)

点选右上方红色按钮执行,用鼠标点选虚拟开发板的按钮开关,或是按压自己的实体开发板的按钮开关,就会看见网页互动区里出现不同的文字。

> 范例解答:[点击 Webduino Bit 按钮开关,显示不同文字](https://webduino.com.cn/link.html?lang=zh-hans&type=example&blockly=button01)
![](img/tutorials/zh_cn/button-04.gif)

## 按钮开关操控全彩点矩阵

按钮开关除了可以和网页元素互动,也可以直接操控 Bit 开发板上的其他组件,接着我们就让按钮开关和全彩点矩阵互动,在点击不同按钮的时候呈现不同的图案,因为要和全彩点矩阵互动,所以在开发板内放入一个全彩点矩阵的积木,* 名称设定为 matrix*,放入两个按钮开关的积木,*名称分别设定为 btnA 与 btnB*

![](img/tutorials/zh_cn/button-05.jpg)

放入当按钮按下执行动作的积木,分别设定按下 btnA 和 btnB 时,全彩点矩阵会显示不同图案。

![](img/tutorials/zh_cn/button-06.jpg)

点选右上方红色按钮执行,用鼠标点选虚拟开发板的按钮开关,或是按压自己的实体开发板的按钮开关,就会看见全彩点矩阵出现不同的图案。

> 范例解答:[Webduino Bit 按钮开关操控全彩点矩阵](https://webduino.com.cn/link.html?lang=zh-hans&type=example&blockly=button02)
![](img/tutorials/zh_cn/button-07.gif)
59 changes: 59 additions & 0 deletions source/bpi-web/advanced/buzzer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 蜂鸣器

蜂鸣器是一个可以产生声音信号的装置,使用直流电供电,接通讯号源之后,音频信号电流通过电磁线圈,使电磁线圈产生磁场,造成振动膜片周期性地振动发声,Webduino Bit 内建的蜂鸣器,能够播放七个八度音阶的声音, 藉由网页填入音符代码,就能播放指定的声音。

## 基本操作

打开 [Webduino Blockly Bit 体验版](https://webduino.com.cn/link.html?lang=zh-hans&type=blockly),在编辑区放入*开发板积木*, 开发板默认使用「*仿真器*」,联机到画面中「*虚拟的 Bit 开发板*」,默认 Device ID 为 「*1234*」。

> 开发板相关积木,在「*开发板*」目录下。
![](img/tutorials/zh_cn/rgbmatrix-01.jpg)

如果是使用「*实体 Bit 开发板*」,下拉选单选择「*Wi-Fi*」,并于后方字段填入开发板的 Device ID。

![](img/tutorials/zh_cn/rgbmatrix-02.jpg)

在开发板内放入「*设定 buzzer 为蜂鸣器*」的积木。

> 蜂鸣器相关积木,在「*蜂鸣器*」目录下。
![](img/tutorials/zh_cn/buzzer-01.jpg)

放入「使用 buzzer 播放」的积木,里头先摆入音符与节奏,「音符」第一个下拉选单有「*无声、C、CS、D、DS、E、F、FS、G、GS、A、AS、B*」,可以想象成钢琴的黑键与白键,有 S 的就是黑键, 第二个下拉选单就是有几个八度音,这里可以设定七个八度音 ( 1~7 ),*数字越大声越高*,「节奏」就是*几分之一秒*,最少可以到 1/10 秒。

> 可以连续放入好几个音符节奏,播放的时候会依据放入的位置顺序播放。
![](img/tutorials/zh_cn/buzzer-02.jpg)

如果觉得一个个的放入音符节奏麻烦,也可以使用一次填入音符节奏的积木。

> 如果节奏的数量小于音符,多出来的音符就会使用最后一个节奏数字播放。
![](img/tutorials/zh_cn/buzzer-03.jpg)

如果完全不会编辑音乐,甚至可以直接使用「音乐」的积木,里头默认有五种不同的曲调旋律。

![](img/tutorials/zh_cn/buzzer-04.jpg)

最后也可以将上面三种播放音乐的模式混合在一起,先播放单音、再播放音乐最后播放一次性的音符节奏。

![](img/tutorials/zh_cn/buzzer-05.jpg)

点选右上方红色按钮执行,如果是虚拟开发板,就会从喇叭或耳机听到声音,如果是实体开发板,就会听见上头的蜂鸣器发出声音了。

> 范例解答:[Webduino Bit 蜂鸣器播放音乐](https://webduino.com.cn/link.html?lang=zh-hans&type=example&blockly=buzzer01)
## 网页按钮操控蜂鸣器

打开网页互动测试区,下拉选单选择「按钮行为」,画面里会出现好几个网页按钮,此时在右下角也会出现对应的积木功能可以选择。

![](img/tutorials/zh_cn/buzzer-06.jpg)

放入「*点选按钮... 执行*」的积木,放入对应蜂鸣器要播放的声音,或是放入设定蜂鸣器播放状态 ( 暂停、停止、继续 ) 的积木,如此一来在点击按钮的时候,蜂鸣器就会播放声音、或是暂停播放。

> 此处常常会忘记放入「*使用 buzzer 播放」的积木,要特别注意*
![](img/tutorials/zh_cn/buzzer-07.jpg)

> 范例解答:[网页按钮操控 Webduino Bit 蜂鸣器](https://webduino.com.cn/link.html?lang=zh-hans&type=example&blockly=buzzer02)
26 changes: 26 additions & 0 deletions source/bpi-web/advanced/detail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Webduino Bit 详细规格

Webduino Bit 是 Webduino 最新的开发板,除了原本的功能一应俱全 ( Wi-Fi 操控、多装置串连、协同作业... 等 ),更内建许多新的组件与传感器,Webduino Bit 采用 ESP32 模块,内建 2.4G Wi-Fi 和蓝牙功能,具备 448KB ROM 和 520 KB SRAM 的内存容量,处理速度达 600 DMIPS,搭配 40nm 工艺的超低功耗,是目前市面上最高效能、最稳定以及最通用的产品之一。

> 如欲操控 Webduino Bit,务必阅读 [Webduino Bit ( 初始化设定 )](setting.html#_top) 进行相关网络设定。
![](img/tutorials/zh_cn/detail-03.gif)

## 默认组件脚位介绍

Webduino Bit 开发板长 5 公分宽 5 公分,重量约 10~12 公克,除了下方 20 Pin 的「金手指接口」,更内建一个 25 颗全彩 LED 灯的矩阵,两个光敏电阻、两个按钮开关、一个温度感应电阻 一个蜂鸣器和一个九轴传感器 ( 三轴加速度、三轴陀螺仪与三轴磁力指南针 ),脚位配置如下:

- *全彩 LED 矩阵*:A10 ( GPIO 4 )
- *光敏传感器*:左上 A0 ( GPIO 36 )、右上 A3 ( GPIO 39 )
- *按钮开关*:按钮 A P5 ( GPIO 35 )、按钮 B P11 ( GPIO 27 )
- *温度传感器*:A6 ( GPIO 34 )
- *蜂鸣器*:P0 ( GPIO 25 )
- *九轴传感器 MPU-9250*:P20 ( GPIO 21 )、P19 ( GPIO 22 )

![](img/tutorials/zh_cn/detail-05.jpg)

![](img/tutorials/zh_cn/detail-04.jpg)

## 外观介绍

![](img/tutorials/zh_cn/detail-01.jpg)
Binary file added source/bpi-web/advanced/img/index/banner.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/index-en.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s2-01-wifi.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s2-03-js.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s2-07-speed.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s3-02-hand.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s4-bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s4-cap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s4-man1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/index/s4-man2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/bpi-web/advanced/img/layout/favicon.ico
Binary file not shown.
Binary file added source/bpi-web/advanced/img/layout/logo-s.png
Binary file added source/bpi-web/advanced/img/layout/logo.png
21 changes: 15 additions & 6 deletions source/bpi-web/advanced/index.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
Webduino 进阶教程
进阶教程
========================================

从这里开始,就正式进入网页物联网开发环节了,请按下述教程开始你的进阶之旅吧。
从这里开始,就正式进入物联网网页开发环节了,请按下述教程开始你的进阶之旅吧。

.. Hint::
可能会有些老生常谈的基础问题,但这并不影响你深入学习。

请在标准环境下进行 `Webduino Blockly 标准版 <https://bit.webduino.com.cn/blockly/>`_ 。
教育版暂不支持导入拓展积木。
.. Hint::

请在标准环境下进行 `Webduino Blockly 标准版 <https://bit.webduino.com.cn/blockly/>`_ 开发。

以下教程对应的教学网站:`在线教学文件 <https://bit.webduino.com.cn/site/zh_cn/tutorials.html>`_ 。

.. toctree::
:maxdepth: 1
:numbered:


detail
setting
blockly
rgbmatrix
button
photocell
temperature
buzzer
mpu9250
45 changes: 45 additions & 0 deletions source/bpi-web/advanced/mpu9250.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 九轴传感器

Webduino Bit 内建一个九轴传感器,型号为 MPU-9250,除了可以侦测空间内的加速度与旋转,更能透过磁力计的辅助侦测,实现侦测姿态角度、指南针... 等进阶应用。

> 注意,使用九轴传感器需*将 Webduino Bit 更新至最新版本*,更新方式请参考:[Webduino Bit 初始化设定](setting.html#_top) 一文的「OTA 远程更新」
## 加速度计

加速度计主要侦测 x、y 和 z 三轴直线移动时「*瞬间*」加速度变化,要使用加速度计必须先了解加速度计在 Webduino Bit 中的方向,如下图所示,将开发板 5x5 全彩点矩阵朝上,金手指接脚朝向自己,*垂直上下的方向为 z 轴* ( 往上为负,往下为正 ),*水平左右为 x 轴* ( 往左为负,往右为正 ) *水平前后为 y 轴* ( 往自己的方向为负,远离自己的方向为正 )。

![](img/tutorials/zh_cn/mpu9250-01.jpg)

打开 [Webduino Blockly Bit 体验版](https://webduino.com.cn/link.html?lang=zh-hans&type=blockly),在编辑区放入*开发板积木*,联机方式选择*Wi-Fi*,并输入 Device ID,接着在开发板内放入「*设定 mup9250 为九轴传感器*」的积木, 在其下方接着摆入「*mpu9250 开始侦测加速度计*」的积木。

![](img/tutorials/zh_cn/mpu9250-02.jpg)

使用显示文字的积木,同时显示 x、y 和 z 方向的加速度,点选右上方红色按钮执行,就会看见三个方向的加速度呈现在网页中,因为所在位置以及传感器初始化校准的不同,每块 Bit 在启用加速度侦测时,都会有些微的误差,但 Z 通常都会是负一千多 ( **单位为 mg**,1 g 通常为一个重力参数 ),X 和 Y 通常会在 200 ~ -200 之间,此时可以拿起 Webduino Bit 上下左右挥动,就会看见数值发生变化,由于所侦测的数值为「*加速度*」,因此 *当开发板没有移动或等速移动的时候,加速度会保持在一个稳定的数值区间内*

> 提醒您,由于侦测的数值为「加速度」,在启动或停止的瞬间,*可能会产生反向的加速度* ( 就如行驶的公交车突然煞车或启动,乘客会往前倾或后仰 ),因此在开发时要透过一些逻辑判断来排除,或避免瞬间太大的启动与停止动作。
![](img/tutorials/zh_cn/mpu9250-03.jpg)

## 陀螺仪

加速度计主要侦测直线移动的瞬间加速度变化,而陀螺仪则是侦测旋转时「*瞬间*」的角度变化,如下图所示,将开发板 5x5 全彩点矩阵朝上,金手指接脚朝向自己,*绕着 z 轴旋转为 yaw* ( 顺时针旋转为正,逆时针旋转为负 ),*绕着 x 轴旋转为 roll* ( 顺时针朝自己旋转为负,逆时针旋转为正 ) *绕着 y 轴旋转为 pitch* ( 顺时针旋转为正,逆时针旋转为负 )。

![](img/tutorials/zh_cn/mpu9250-04.jpg)

积木组合方式和加速度计相同,只需将开始侦测下拉选单选择「陀螺仪」,点选右上方红色按钮执行,就会看见三个方向转动的角度变化呈现在网页中,因为是瞬间角度变化,所以当*停止转动后,会看到角度逐渐回归启动时的数值*

![](img/tutorials/zh_cn/mpu9250-05.jpg)

## 姿态角度 ( 目前仅支持 roll 和 pitch )

有别于陀螺仪呈现的是「瞬间」角度变化,姿态角度表现的是实际转动的夹角,如下图所示,将开发板 5x5 全彩点矩阵朝上,金手指接脚朝向自己,*绕着 z 轴旋转为 yaw* ( 逆时针旋转角度递增,区间为 -180~180 度 ),*绕着 x 轴旋转 为 roll* ( 顺时针旋转角度递增,区间为 -180~180 度 ) *绕着 y 轴旋转为 pitch* ( 逆时针旋转角度递增,区间为 -180~180 度 )。

![](img/tutorials/zh_cn/mpu9250-06.jpg)

积木组合方式和加速度计相同,只需将开始侦测下拉选单选择「姿态角度」,点选右上方红色按钮执行,就会看见三个方向转动的角度变化呈现在网页中。

![](img/tutorials/zh_cn/mpu9250-07.jpg)

## 磁力计

磁力计主要可以计算出开发板在地球磁场空间内的数值,但主要会取决于所在地的经纬度,目前较无法提供一个准确的数值区间参考,因此使用上建议采用加速度计、陀螺仪或姿态角度来实现应用,积木组合方式和加速度计相同, 只需将开始侦测下拉选单选择「磁力计」,点选右上方红色按钮执行,就会看见三个数值呈现在网页中。

0 comments on commit ba2e583

Please sign in to comment.