diff --git a/1-getting-started/lessons/1-introduction-to-iot/README.md b/1-getting-started/lessons/1-introduction-to-iot/README.md index b739ddc7..6d1401eb 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/README.md +++ b/1-getting-started/lessons/1-introduction-to-iot/README.md @@ -4,6 +4,14 @@ > Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version. +This lesson was taught as part of the [Hello IoT series](https://youtube.com/playlist?list=PLmsFUfdnGr3xRts0TIwyaHyQuHaNQcb6-) from the [Microsoft Reactor](https://developer.microsoft.com/reactor/?WT.mc_id=academic-17441-jabenn). The lesson was taught as 2 videos - a 1 hour lesson, and a 1 hour office hour diving deeper into parts of the lesson and answering questions. + +[![Lesson 1: Introduction to IoT](https://img.youtube.com/vi/bVFfcYh6UBw/0.jpg)](https://youtu.be/bVFfcYh6UBw) + +[![Lesson 1: Introduction to IoT - Office hours](https://img.youtube.com/vi/YI772q5v3yI/0.jpg)](https://youtu.be/YI772q5v3yI) + +> 🎥 Click the images above to watch the videos + ## Pre-lecture quiz [Pre-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/1) diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md index 426f26fc..dcee1b19 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md @@ -239,6 +239,6 @@ Hello World! ``` -> 💁 你可以在[code/pi](code/pi) 文件夹里找到这个代码 +> 💁 你可以在[code/pi](../code/pi) 文件夹里找到这个代码 😀 你的'Hello World'程序成功了! diff --git a/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md b/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md index dbda7c91..ec101791 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md +++ b/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md @@ -55,11 +55,18 @@ Configure a Python virtual environment and install the pip packages for CounterF 1. Activate the virtual environment: - * On Windows run: + * On Windows: + * If you are using the Command Prompt, or the Command Prompt through Windows Terminal, run: - ```cmd - .venv\Scripts\activate.bat - ``` + ```cmd + .venv\Scripts\activate.bat + ``` + + * If you are using PowerShell, run: + + ```powershell + .\.venv\Scripts\Activate.ps1 + ``` * On macOS or Linux, run: @@ -67,6 +74,8 @@ Configure a Python virtual environment and install the pip packages for CounterF source ./.venv/bin/activate ``` + > 💁 These commands should be run from the same location you ran the command to create the virtual environment. You will never need to navigate into the `.venv` folder, you should always run the activate command and any commands to install packages or run code from the folder you were in when you created the virtual environment. + 1. Once the virtual environment has been activated, the default `python` command will run the version of Python that was used to create the virtual environment. Run the following to get the version: ```sh diff --git a/1-getting-started/lessons/2-deeper-dive/README.md b/1-getting-started/lessons/2-deeper-dive/README.md index 7b8b2a59..f140f403 100644 --- a/1-getting-started/lessons/2-deeper-dive/README.md +++ b/1-getting-started/lessons/2-deeper-dive/README.md @@ -4,6 +4,14 @@ > Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version. +This lesson was taught as part of the [Hello IoT series](https://youtube.com/playlist?list=PLmsFUfdnGr3xRts0TIwyaHyQuHaNQcb6-) from the [Microsoft Reactor](https://developer.microsoft.com/reactor/?WT.mc_id=academic-17441-jabenn). The lesson was taught as 2 videos - a 1 hour lesson, and a 1 hour office hour diving deeper into parts of the lesson and answering questions. + +[![Lesson 2: A deeper dive into IoT](https://img.youtube.com/vi/t0SySWw3z9M/0.jpg)](https://youtu.be/t0SySWw3z9M) + +[![Lesson 2: A deeper dive into IoT - Office hours](https://img.youtube.com/vi/tTZYf9EST1E/0.jpg)](https://youtu.be/tTZYf9EST1E) + +> 🎥 Click the images above to watch the videos + ## Pre-lecture quiz [Pre-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/3) diff --git a/1-getting-started/lessons/3-sensors-and-actuators/README.md b/1-getting-started/lessons/3-sensors-and-actuators/README.md index 1e17e0de..9f7a1615 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/README.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/README.md @@ -4,6 +4,14 @@ > Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version. +This lesson was taught as part of the [Hello IoT series](https://youtube.com/playlist?list=PLmsFUfdnGr3xRts0TIwyaHyQuHaNQcb6-) from the [Microsoft Reactor](https://developer.microsoft.com/reactor/?WT.mc_id=academic-17441-jabenn). The lesson was taught as 2 videos - a 1 hour lesson, and a 1 hour office hour diving deeper into parts of the lesson and answering questions. + +[![Lesson 3: Interact with the Physical World with Sensors and Actuators](https://img.youtube.com/vi/Lqalu1v6aF4/0.jpg)](https://youtu.be/Lqalu1v6aF4) + +[![Lesson 3: Interact with the Physical World with Sensors and Actuators - Office hours](https://img.youtube.com/vi/qR3ekcMlLWA/0.jpg)](https://youtu.be/qR3ekcMlLWA) + +> 🎥 Click the images above to watch the videos + ## Pre-lecture quiz [Pre-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/5) diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md new file mode 100644 index 00000000..2b0da418 --- /dev/null +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md @@ -0,0 +1,115 @@ +# 开发一个夜灯 - 树莓派 + +在这个部分的课程中,你会把一个LED加到树莓派上并使用它来创建一个夜灯。 + +## 硬件 + +现在夜灯需要一个执行器。 + +这个执行器是**LED**,一个[发光二极管](https://wikipedia.org/wiki/Light-emitting_diode),当电流通过它时会发光。这是一个有两个打开或者关闭状态的数字执行器,发送一个1值把灯打开,发送0把灯关闭。这个LED是一个外部Grove执行器,而且需要被连接到树莓派上的Grove基础扩展板。 + +这个夜灯的逻辑用伪代码表示是: + +```output +检查光照等级。 +如果光照小于300 + 打开LED +否则 + 关闭LED +``` + +### 连接LED + +Grove LED 作为一个模块出现,以及一系列可供你选择颜色的LED。 + +#### 任务 - 连接LED + +连接LED。 + +![一个grove LED](../../../../images/grove-led.png) + +1. 选择你最喜欢的LED然后把引脚插到LED模块的两个洞里面。 + + LED是发光二极管,而且二极管是只允许电流单个方向通过的电子设备。这意味LED需要被连接在正确的方向,不然就不会工作。 + + LED引脚中的一个是正极引脚,另一个是负极引脚。LED不是完全的圆形,而且在一边是有些平的。这略平的一边是负极引脚。当你连接LED到这个模块的时候,需要确保圆形这边的引脚是连接到模块上外边标着 **+** 的插孔,而扁平的这边是连接到靠近模块中间的插孔。 + +1. LED模块有一个允许你控制亮度的旋转按钮,用一个小十字螺丝起子逆时针旋转它拧到头来完全打开它。 + +1. 把Grove线缆的一端插到LED模块的插孔中,这个只能从一个方向插入。 + +1. 在树莓派断电的情况下,把Grove线缆的另一端连接到树莓派上插着的Grove基础扩展板标着 **D5** 的数字插孔。这个插孔在靠近GPIO引脚的一排,左数第二个。 + +![连接到D5插孔的Grove LED](../../../../images/pi-led.png) + +## 编写夜灯程序 + +现在夜灯可以用Grove光照传感器和Grove LED来编码了。 + +### 任务 - 编写夜灯程序 + +编写夜灯程序 + +1. 打开树莓派并等待启动完成。 + +1. 直接在树莓派上或者通过远程SSH扩展,打开你在这个作业上一部分创建的VS Code中的夜灯项目。 + +1. 把下面的代码加到`app.py`文件中来导入一个需要的函数库。这一行需要加在文件顶部,在其他`import`代码行下面。 + + ```python + from grove.grove_led import GroveLed + ``` + `from grove.grove_led import GroveLed`语句从Grove Python函数库中导入了`GroveLED`。这个函数库中有和Grove LED交互的代码。 + +1. 把下面的代码加到`light_sensor`声明之后来创建一个管理LED的类的实例: + + ```python + led = GroveLed(5) + ``` + + `led = GroveLed(5)`这一行创建了一个连接到 **D5** 引脚的`GroveLED`类的实例,**D5** 也就是LED连接的那个数字Grove引脚。 + + > 💁 所有的插孔都有唯一的引脚号,引脚0、2、4和6是模拟引脚,引脚5、16、18、22、24和26是数字引脚。 + +1. 在`while`循环中增加一个判断,在`time.sleep`之前来检查光照等级并控制LED打开或者关闭: + + ```python + if light < 300: + led.on() + else: + led.off() + ``` + + 这块代码检查了`light`的值,如果小于300就调用`GroveLED`类的`on`方法,来发送一个数字值1到LED,把它点亮。如果`light`值大于或等于300,就调用`off`方法,发送一个数字值0给LED,把它关闭。 + + > 💁 这段代码需要放到while循环里面,缩进到和`print('Light level:', light)`行一个水平。 + + > 💁 当发送数字值到执行器的时候,0值就是0v,1值就是设备的最大电压。对于插着Grove传感器和执行器的树莓派而言,1的电压就是3.3V。 + +1. 从VS Code终端,运行下面的命令来运行你的Python应用: + + ```sh + python3 app.py + ``` + + 光照值在终端里输出。 + + ```output + pi@raspberrypi:~/nightlight $ python3 app.py + Light level: 634 + Light level: 634 + Light level: 634 + Light level: 230 + Light level: 104 + Light level: 290 + ``` + +1. 遮挡或者揭开光照传感器,会观察到光照等级等于300或更小时LED会点亮,如果光照等级比300大LED就会关闭。 + + > 💁 如果LED没有点亮,确保它是正确方向连接的,而且旋转按钮是设置成全开的。 + +![连接到树莓派的LED随着光照等级改变点亮和关闭](../../../../images/pi-running-assignment-1-1.gif) + +> 💁 你可以在[code-actuator/pi](../code-actuator/pi)文件夹里找到这份代码。 + +😀 你的夜灯程序就成功了! diff --git a/1-getting-started/lessons/4-connect-internet/README.md b/1-getting-started/lessons/4-connect-internet/README.md index 475239f8..31567fcd 100644 --- a/1-getting-started/lessons/4-connect-internet/README.md +++ b/1-getting-started/lessons/4-connect-internet/README.md @@ -4,6 +4,14 @@ > Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version. +This lesson was taught as part of the [Hello IoT series](https://youtube.com/playlist?list=PLmsFUfdnGr3xRts0TIwyaHyQuHaNQcb6-) from the [Microsoft Reactor](https://developer.microsoft.com/reactor/?WT.mc_id=academic-17441-jabenn). The lesson was taught as 2 videos - a 1 hour lesson, and a 1 hour office hour diving deeper into parts of the lesson and answering questions. + +[![Lesson 4: Connect your Device to the Internet](https://img.youtube.com/vi/O4dd172mZhs/0.jpg)](https://youtu.be/O4dd172mZhs) + +[![Lesson 4: Connect your Device to the Internet - Office hours](https://img.youtube.com/vi/j-cVCzRDE2Q/0.jpg)](https://youtu.be/j-cVCzRDE2Q) + +> 🎥 Click the images above to watch the videos + ## Pre-lecture quiz [Pre-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/7) @@ -178,11 +186,18 @@ Configure a Python virtual environment and install the MQTT pip packages. 1. Activate the virtual environment: - * On Windows run: + * On Windows: + * If you are using the Command Prompt, or the Command Prompt through Windows Terminal, run: - ```cmd - .venv\Scripts\activate.bat - ``` + ```cmd + .venv\Scripts\activate.bat + ``` + + * If you are using PowerShell, run: + + ```powershell + .\.venv\Scripts\Activate.ps1 + ``` * On macOS or Linux, run: @@ -190,6 +205,8 @@ Configure a Python virtual environment and install the MQTT pip packages. source ./.venv/bin/activate ``` + > 💁 These commands should be run from the same location you ran the command to create the virtual environment. You will never need to navigate into the `.venv` folder, you should always run the activate command and any commands to install packages or run code from the folder you were in when you created the virtual environment. + 1. Once the virtual environment has been activated, the default `python` command will run the version of Python that was used to create the virtual environment. Run the following to get the version: ```sh diff --git a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md index 3d428cec..3811b456 100644 --- a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md +++ b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md @@ -131,11 +131,18 @@ The Azure Functions CLI can be used to create a new Functions app. 1. Activate the virtual environment: - * On Windows run: + * On Windows: + * If you are using the Command Prompt, or the Command Prompt through Windows Terminal, run: - ```cmd - .venv\Scripts\activate.bat - ``` + ```cmd + .venv\Scripts\activate.bat + ``` + + * If you are using PowerShell, run: + + ```powershell + .\.venv\Scripts\Activate.ps1 + ``` * On macOS or Linux, run: @@ -143,6 +150,8 @@ The Azure Functions CLI can be used to create a new Functions app. source ./.venv/bin/activate ``` + > 💁 These commands should be run from the same location you ran the command to create the virtual environment. You will never need to navigate into the `.venv` folder, you should always run the activate command and any commands to install packages or run code from the folder you were in when you created the virtual environment. + 1. Run the following command to create a Functions app in this folder: ```sh diff --git a/README.md b/README.md index 84e45fd3..a4bacfb8 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,10 @@ npm i npm run convert ``` +### Slides + +There are slide decks for some of the lessons in the [slides](./slides) folder. + ## Help Wanted! Would you like to contribute a translation? Please read our [translation guidelines](TRANSLATIONS.md) and add input [to one of the translations issues](https://github.com/microsoft/IoT-For-Beginners/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation). If you want to translate into a new language, please raise a new issue for tracking. diff --git a/slides/lesson-1.pdf b/slides/lesson-1.pdf new file mode 100644 index 00000000..e6a2e94c Binary files /dev/null and b/slides/lesson-1.pdf differ diff --git a/slides/lesson-2.pdf b/slides/lesson-2.pdf new file mode 100644 index 00000000..ba3e46a1 Binary files /dev/null and b/slides/lesson-2.pdf differ diff --git a/slides/lesson-3.pdf b/slides/lesson-3.pdf new file mode 100644 index 00000000..11699edb Binary files /dev/null and b/slides/lesson-3.pdf differ diff --git a/slides/lesson-4.pdf b/slides/lesson-4.pdf new file mode 100644 index 00000000..c0d70d7a Binary files /dev/null and b/slides/lesson-4.pdf differ