-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
docs/microbit/wisdom-life/microbit-smart-life-kit/cases-libraries/case-01.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_label: 智能灯 | ||
--- | ||
|
||
# 智能灯 | ||
|
||
## 简介 | ||
|
||
在本项目中,我们将学习如何制作一个智能灯,采用光线传感器监测环境光照。当检测到光线不足时,系统自动启动LED灯,提供充足的照明。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/wisdom-life/microbit-smart-life-kit/images/case-01-01.png) | ||
|
||
## 教学目标 | ||
|
||
了解光线传感器的使用方式 | ||
|
||
掌握使用micro:bit控制LED灯的基本编程技能。 | ||
|
||
## 教学准备 | ||
|
||
在开始教学之前,请确保您已经准备好以下必要的材料: | ||
|
||
| **图片** | **名称** | **数量** | **备注** | | ||
| --- | --- | --- | --- | | ||
| ![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/wisdom-life/microbit-smart-life-kit/images/microbit-smart-life-kit.png) | 智慧生活套装 | 1 | | | ||
| ![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/USB-data-cable.png) | USB数据线 | 1 | | | ||
| ![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/microbit.png) | micro:bit | 1 | 自行准备 | | ||
| ![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/pc.png) | PC | 1 | 自行准备 | | ||
|
||
这些材料将为您提供一个完整的体验,确保您可以顺利地进行后续的操作和学习。如果您已准备好以上内容,我们可以继续进入下一步。 | ||
|
||
|
||
## 项目制作 | ||
|
||
### 硬件连接 | ||
|
||
将光线传感器连接到悟空扩展板的P1接口,将彩虹灯连接到悟空扩展板的P2接口,将OLED显示屏插入IIC接口。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/wisdom-life/microbit-smart-life-kit/images/case-01-02.png) | ||
|
||
### 编程平台 | ||
|
||
我们通常使用[图形化编程平台makecode](https://makecode.microbit.org/)对micro:bit进行编程 | ||
|
||
编程平台入口:[https://makecode.microbit.org/](https://makecode.microbit.org/) | ||
|
||
### 新建项目 | ||
|
||
打开[https://makecode.microbit.org/](https://makecode.microbit.org/) | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/makecode.png) | ||
|
||
新建项目 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/makecode-new-project-01.png) | ||
|
||
输入项目名称并点击创建。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/cutebot-fun-football-game-kit/cases-libraries/images/makecode-new-project-02.png) | ||
|
||
### 编写程序 | ||
|
||
示例程序:[https://makecode.microbit.org/_cvA28PcpAWLJ](https://makecode.microbit.org/_cvA28PcpAWLJ) | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/wisdom-life/microbit-smart-life-kit/images/case-01-03.png) | ||
|
||
你也可以通过以下网页直接下载程序。 | ||
|
||
<div | ||
style={{ | ||
position: 'relative', | ||
paddingBottom: '60%', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
<iframe | ||
src="https://makecode.microbit.org/_cvA28PcpAWLJ" | ||
frameborder="0" | ||
sandbox="allow-popups allow-forms allow-scripts allow-same-origin" | ||
style={{ | ||
position: 'absolute', | ||
width: '100%', | ||
height: '100%', | ||
}} | ||
/> | ||
</div> | ||
|
||
|
||
|
||
|
||
### 如何将程序下载到micro:bit? | ||
|
||
使用USB线连接PC和micro:bit V2。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/connect-microbit.gif) | ||
|
||
连接成功后,电脑上会识别出一个名为`MICROBIT`的盘符。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/microbit-drive.png) | ||
|
||
点击左下角的![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-01.png),选择`Connect Device`。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-02.png) | ||
|
||
点击![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-03.png)。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-04.png) | ||
|
||
点击![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-05.png)。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-06.png) | ||
|
||
|
||
在弹出窗口选择`BBC micro:bit CMSIS-DAP`,然后选择连接,至此,我们的micro:bit就已经连接成功。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-07.png) | ||
|
||
点击下载程序。 | ||
|
||
![](https://wiki-media-ef.oss-cn-hongkong.aliyuncs.com/docs/microbit/interesting-case/microbit-smart-climate-kit/cases-libraries/images/download-08.png) | ||
|
||
|
||
### 结果 | ||
|
||
开机后,智能灯根据环境光强度自动点亮或者熄灭彩虹灯。 |
15 changes: 15 additions & 0 deletions
15
docs/microbit/wisdom-life/microbit-smart-life-kit/cases-libraries/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
sidebar_position: 5 | ||
sidebar_label: 案例库 | ||
--- | ||
|
||
# 案例库 | ||
|
||
|
||
## 目录 | ||
|
||
```mdx-code-block | ||
import DocCardList from '@theme/DocCardList'; | ||
<DocCardList /> | ||
``` |