diff --git "a/docs/thonny/Python \345\233\272\344\273\266/esp32-20230426-v1.20.0.bin" "b/docs/thonny/Python \345\233\272\344\273\266/esp32-20230426-v1.20.0.bin" new file mode 100644 index 0000000..560daf6 Binary files /dev/null and "b/docs/thonny/Python \345\233\272\344\273\266/esp32-20230426-v1.20.0.bin" differ diff --git a/docs/thonny/pictures/image10.jpeg b/docs/thonny/pictures/image10.jpeg new file mode 100644 index 0000000..a42e797 Binary files /dev/null and b/docs/thonny/pictures/image10.jpeg differ diff --git a/docs/thonny/pictures/image11.jpeg b/docs/thonny/pictures/image11.jpeg new file mode 100644 index 0000000..f271a3e Binary files /dev/null and b/docs/thonny/pictures/image11.jpeg differ diff --git a/docs/thonny/pictures/image12.jpeg b/docs/thonny/pictures/image12.jpeg new file mode 100644 index 0000000..7e3ba6d Binary files /dev/null and b/docs/thonny/pictures/image12.jpeg differ diff --git a/docs/thonny/pictures/image13.jpeg b/docs/thonny/pictures/image13.jpeg new file mode 100644 index 0000000..b75ece7 Binary files /dev/null and b/docs/thonny/pictures/image13.jpeg differ diff --git a/docs/thonny/pictures/image14.jpeg b/docs/thonny/pictures/image14.jpeg new file mode 100644 index 0000000..eb3483c Binary files /dev/null and b/docs/thonny/pictures/image14.jpeg differ diff --git a/docs/thonny/pictures/image15.jpeg b/docs/thonny/pictures/image15.jpeg new file mode 100644 index 0000000..ce7d879 Binary files /dev/null and b/docs/thonny/pictures/image15.jpeg differ diff --git a/docs/thonny/pictures/image16.jpeg b/docs/thonny/pictures/image16.jpeg new file mode 100644 index 0000000..14f1bce Binary files /dev/null and b/docs/thonny/pictures/image16.jpeg differ diff --git a/docs/thonny/pictures/image17.jpeg b/docs/thonny/pictures/image17.jpeg new file mode 100644 index 0000000..1ca1b6c Binary files /dev/null and b/docs/thonny/pictures/image17.jpeg differ diff --git a/docs/thonny/pictures/image18.jpeg b/docs/thonny/pictures/image18.jpeg new file mode 100644 index 0000000..6e08b20 Binary files /dev/null and b/docs/thonny/pictures/image18.jpeg differ diff --git a/docs/thonny/pictures/image19.jpeg b/docs/thonny/pictures/image19.jpeg new file mode 100644 index 0000000..3cf38b8 Binary files /dev/null and b/docs/thonny/pictures/image19.jpeg differ diff --git a/docs/thonny/pictures/image20.jpeg b/docs/thonny/pictures/image20.jpeg new file mode 100644 index 0000000..23aab0a Binary files /dev/null and b/docs/thonny/pictures/image20.jpeg differ diff --git a/docs/thonny/pictures/image21.jpeg b/docs/thonny/pictures/image21.jpeg new file mode 100644 index 0000000..46ae64b Binary files /dev/null and b/docs/thonny/pictures/image21.jpeg differ diff --git a/docs/thonny/pictures/image22.jpeg b/docs/thonny/pictures/image22.jpeg new file mode 100644 index 0000000..d74e11b Binary files /dev/null and b/docs/thonny/pictures/image22.jpeg differ diff --git a/docs/thonny/pictures/image23.jpeg b/docs/thonny/pictures/image23.jpeg new file mode 100644 index 0000000..d69255c Binary files /dev/null and b/docs/thonny/pictures/image23.jpeg differ diff --git a/docs/thonny/pictures/image24.jpeg b/docs/thonny/pictures/image24.jpeg new file mode 100644 index 0000000..39362a4 Binary files /dev/null and b/docs/thonny/pictures/image24.jpeg differ diff --git a/docs/thonny/pictures/image25.jpeg b/docs/thonny/pictures/image25.jpeg new file mode 100644 index 0000000..0655beb Binary files /dev/null and b/docs/thonny/pictures/image25.jpeg differ diff --git a/docs/thonny/pictures/image26.jpeg b/docs/thonny/pictures/image26.jpeg new file mode 100644 index 0000000..a45882c Binary files /dev/null and b/docs/thonny/pictures/image26.jpeg differ diff --git a/docs/thonny/pictures/image27.jpeg b/docs/thonny/pictures/image27.jpeg new file mode 100644 index 0000000..748156a Binary files /dev/null and b/docs/thonny/pictures/image27.jpeg differ diff --git a/docs/thonny/pictures/image28.jpeg b/docs/thonny/pictures/image28.jpeg new file mode 100644 index 0000000..12327f0 Binary files /dev/null and b/docs/thonny/pictures/image28.jpeg differ diff --git a/docs/thonny/pictures/image29.jpeg b/docs/thonny/pictures/image29.jpeg new file mode 100644 index 0000000..52010e9 Binary files /dev/null and b/docs/thonny/pictures/image29.jpeg differ diff --git a/docs/thonny/pictures/image30.jpeg b/docs/thonny/pictures/image30.jpeg new file mode 100644 index 0000000..eb15f4a Binary files /dev/null and b/docs/thonny/pictures/image30.jpeg differ diff --git a/docs/thonny/pictures/image31.jpeg b/docs/thonny/pictures/image31.jpeg new file mode 100644 index 0000000..38a6da9 Binary files /dev/null and b/docs/thonny/pictures/image31.jpeg differ diff --git a/docs/thonny/pictures/image32.jpeg b/docs/thonny/pictures/image32.jpeg new file mode 100644 index 0000000..bb09b2f Binary files /dev/null and b/docs/thonny/pictures/image32.jpeg differ diff --git a/docs/thonny/pictures/image33.jpeg b/docs/thonny/pictures/image33.jpeg new file mode 100644 index 0000000..29c194b Binary files /dev/null and b/docs/thonny/pictures/image33.jpeg differ diff --git a/docs/thonny/pictures/image34.jpeg b/docs/thonny/pictures/image34.jpeg new file mode 100644 index 0000000..f17efcc Binary files /dev/null and b/docs/thonny/pictures/image34.jpeg differ diff --git a/docs/thonny/pictures/image35.jpeg b/docs/thonny/pictures/image35.jpeg new file mode 100644 index 0000000..1ca1b6c Binary files /dev/null and b/docs/thonny/pictures/image35.jpeg differ diff --git a/docs/thonny/pictures/image36.jpeg b/docs/thonny/pictures/image36.jpeg new file mode 100644 index 0000000..bd527b0 Binary files /dev/null and b/docs/thonny/pictures/image36.jpeg differ diff --git a/docs/thonny/pictures/image37.jpeg b/docs/thonny/pictures/image37.jpeg new file mode 100644 index 0000000..4036617 Binary files /dev/null and b/docs/thonny/pictures/image37.jpeg differ diff --git a/docs/thonny/pictures/image38.jpeg b/docs/thonny/pictures/image38.jpeg new file mode 100644 index 0000000..2b2712d Binary files /dev/null and b/docs/thonny/pictures/image38.jpeg differ diff --git a/docs/thonny/pictures/image39.jpeg b/docs/thonny/pictures/image39.jpeg new file mode 100644 index 0000000..d0d7a4d Binary files /dev/null and b/docs/thonny/pictures/image39.jpeg differ diff --git a/docs/thonny/pictures/image40.jpeg b/docs/thonny/pictures/image40.jpeg new file mode 100644 index 0000000..0b2f1e9 Binary files /dev/null and b/docs/thonny/pictures/image40.jpeg differ diff --git a/docs/thonny/pictures/image41.jpeg b/docs/thonny/pictures/image41.jpeg new file mode 100644 index 0000000..4b77520 Binary files /dev/null and b/docs/thonny/pictures/image41.jpeg differ diff --git a/docs/thonny/pictures/image42.jpeg b/docs/thonny/pictures/image42.jpeg new file mode 100644 index 0000000..03e07f5 Binary files /dev/null and b/docs/thonny/pictures/image42.jpeg differ diff --git a/docs/thonny/pictures/image43.jpeg b/docs/thonny/pictures/image43.jpeg new file mode 100644 index 0000000..a9d3364 Binary files /dev/null and b/docs/thonny/pictures/image43.jpeg differ diff --git a/docs/thonny/pictures/image44.jpeg b/docs/thonny/pictures/image44.jpeg new file mode 100644 index 0000000..38a0cd7 Binary files /dev/null and b/docs/thonny/pictures/image44.jpeg differ diff --git a/docs/thonny/pictures/image45.jpeg b/docs/thonny/pictures/image45.jpeg new file mode 100644 index 0000000..1ca1b6c Binary files /dev/null and b/docs/thonny/pictures/image45.jpeg differ diff --git a/docs/thonny/pictures/image46.jpeg b/docs/thonny/pictures/image46.jpeg new file mode 100644 index 0000000..6f81a80 Binary files /dev/null and b/docs/thonny/pictures/image46.jpeg differ diff --git a/docs/thonny/pictures/image47.jpeg b/docs/thonny/pictures/image47.jpeg new file mode 100644 index 0000000..6f81a80 Binary files /dev/null and b/docs/thonny/pictures/image47.jpeg differ diff --git a/docs/thonny/pictures/image48.jpeg b/docs/thonny/pictures/image48.jpeg new file mode 100644 index 0000000..1894b2d Binary files /dev/null and b/docs/thonny/pictures/image48.jpeg differ diff --git a/docs/thonny/pictures/image49.jpeg b/docs/thonny/pictures/image49.jpeg new file mode 100644 index 0000000..4665c72 Binary files /dev/null and b/docs/thonny/pictures/image49.jpeg differ diff --git a/docs/thonny/pictures/image50.jpeg b/docs/thonny/pictures/image50.jpeg new file mode 100644 index 0000000..5228599 Binary files /dev/null and b/docs/thonny/pictures/image50.jpeg differ diff --git a/docs/thonny/pictures/image51.jpeg b/docs/thonny/pictures/image51.jpeg new file mode 100644 index 0000000..6ed3b04 Binary files /dev/null and b/docs/thonny/pictures/image51.jpeg differ diff --git a/docs/thonny/pictures/image52.jpeg b/docs/thonny/pictures/image52.jpeg new file mode 100644 index 0000000..442d998 Binary files /dev/null and b/docs/thonny/pictures/image52.jpeg differ diff --git a/docs/thonny/pictures/image53.jpeg b/docs/thonny/pictures/image53.jpeg new file mode 100644 index 0000000..76f7371 Binary files /dev/null and b/docs/thonny/pictures/image53.jpeg differ diff --git a/docs/thonny/pictures/image54.jpeg b/docs/thonny/pictures/image54.jpeg new file mode 100644 index 0000000..b5a25f7 Binary files /dev/null and b/docs/thonny/pictures/image54.jpeg differ diff --git a/docs/thonny/pictures/image55.jpeg b/docs/thonny/pictures/image55.jpeg new file mode 100644 index 0000000..4e35dfe Binary files /dev/null and b/docs/thonny/pictures/image55.jpeg differ diff --git a/docs/thonny/pictures/image56.jpeg b/docs/thonny/pictures/image56.jpeg new file mode 100644 index 0000000..f6b7173 Binary files /dev/null and b/docs/thonny/pictures/image56.jpeg differ diff --git a/docs/thonny/pictures/image57.jpeg b/docs/thonny/pictures/image57.jpeg new file mode 100644 index 0000000..29c194b Binary files /dev/null and b/docs/thonny/pictures/image57.jpeg differ diff --git a/docs/thonny/pictures/image58.jpeg b/docs/thonny/pictures/image58.jpeg new file mode 100644 index 0000000..57f42dd Binary files /dev/null and b/docs/thonny/pictures/image58.jpeg differ diff --git a/docs/thonny/pictures/image59.jpeg b/docs/thonny/pictures/image59.jpeg new file mode 100644 index 0000000..f398c1f Binary files /dev/null and b/docs/thonny/pictures/image59.jpeg differ diff --git a/docs/thonny/pictures/image6.jpeg b/docs/thonny/pictures/image6.jpeg new file mode 100644 index 0000000..3de83dd Binary files /dev/null and b/docs/thonny/pictures/image6.jpeg differ diff --git a/docs/thonny/pictures/image60.jpeg b/docs/thonny/pictures/image60.jpeg new file mode 100644 index 0000000..1ca1b6c Binary files /dev/null and b/docs/thonny/pictures/image60.jpeg differ diff --git a/docs/thonny/pictures/image61.jpeg b/docs/thonny/pictures/image61.jpeg new file mode 100644 index 0000000..f5a157b Binary files /dev/null and b/docs/thonny/pictures/image61.jpeg differ diff --git a/docs/thonny/pictures/image62.jpeg b/docs/thonny/pictures/image62.jpeg new file mode 100644 index 0000000..0655beb Binary files /dev/null and b/docs/thonny/pictures/image62.jpeg differ diff --git a/docs/thonny/pictures/image63.jpeg b/docs/thonny/pictures/image63.jpeg new file mode 100644 index 0000000..39b316f Binary files /dev/null and b/docs/thonny/pictures/image63.jpeg differ diff --git a/docs/thonny/pictures/image64.jpeg b/docs/thonny/pictures/image64.jpeg new file mode 100644 index 0000000..c77885c Binary files /dev/null and b/docs/thonny/pictures/image64.jpeg differ diff --git a/docs/thonny/pictures/image65.jpeg b/docs/thonny/pictures/image65.jpeg new file mode 100644 index 0000000..748156a Binary files /dev/null and b/docs/thonny/pictures/image65.jpeg differ diff --git a/docs/thonny/pictures/image66.jpeg b/docs/thonny/pictures/image66.jpeg new file mode 100644 index 0000000..a69f0fb Binary files /dev/null and b/docs/thonny/pictures/image66.jpeg differ diff --git a/docs/thonny/pictures/image67.jpeg b/docs/thonny/pictures/image67.jpeg new file mode 100644 index 0000000..f398c1f Binary files /dev/null and b/docs/thonny/pictures/image67.jpeg differ diff --git a/docs/thonny/pictures/image68.jpeg b/docs/thonny/pictures/image68.jpeg new file mode 100644 index 0000000..9462844 Binary files /dev/null and b/docs/thonny/pictures/image68.jpeg differ diff --git a/docs/thonny/pictures/image69.jpeg b/docs/thonny/pictures/image69.jpeg new file mode 100644 index 0000000..db52a20 Binary files /dev/null and b/docs/thonny/pictures/image69.jpeg differ diff --git a/docs/thonny/pictures/image7.jpeg b/docs/thonny/pictures/image7.jpeg new file mode 100644 index 0000000..848086b Binary files /dev/null and b/docs/thonny/pictures/image7.jpeg differ diff --git a/docs/thonny/pictures/image70.jpeg b/docs/thonny/pictures/image70.jpeg new file mode 100644 index 0000000..64117a3 Binary files /dev/null and b/docs/thonny/pictures/image70.jpeg differ diff --git a/docs/thonny/pictures/image71.jpeg b/docs/thonny/pictures/image71.jpeg new file mode 100644 index 0000000..8a995bb Binary files /dev/null and b/docs/thonny/pictures/image71.jpeg differ diff --git a/docs/thonny/pictures/image72.jpeg b/docs/thonny/pictures/image72.jpeg new file mode 100644 index 0000000..896c512 Binary files /dev/null and b/docs/thonny/pictures/image72.jpeg differ diff --git a/docs/thonny/pictures/image73.jpeg b/docs/thonny/pictures/image73.jpeg new file mode 100644 index 0000000..acf669f Binary files /dev/null and b/docs/thonny/pictures/image73.jpeg differ diff --git a/docs/thonny/pictures/image74.jpeg b/docs/thonny/pictures/image74.jpeg new file mode 100644 index 0000000..02e6924 Binary files /dev/null and b/docs/thonny/pictures/image74.jpeg differ diff --git a/docs/thonny/pictures/image75 .jpeg b/docs/thonny/pictures/image75 .jpeg new file mode 100644 index 0000000..f01c034 Binary files /dev/null and b/docs/thonny/pictures/image75 .jpeg differ diff --git a/docs/thonny/pictures/image76.jpeg b/docs/thonny/pictures/image76.jpeg new file mode 100644 index 0000000..a69f0fb Binary files /dev/null and b/docs/thonny/pictures/image76.jpeg differ diff --git a/docs/thonny/pictures/image77.jpeg b/docs/thonny/pictures/image77.jpeg new file mode 100644 index 0000000..1ca1b6c Binary files /dev/null and b/docs/thonny/pictures/image77.jpeg differ diff --git a/docs/thonny/pictures/image78-2.jpeg b/docs/thonny/pictures/image78-2.jpeg new file mode 100644 index 0000000..0f3e125 Binary files /dev/null and b/docs/thonny/pictures/image78-2.jpeg differ diff --git a/docs/thonny/pictures/image78.jpeg b/docs/thonny/pictures/image78.jpeg new file mode 100644 index 0000000..264370b Binary files /dev/null and b/docs/thonny/pictures/image78.jpeg differ diff --git a/docs/thonny/pictures/image79.jpeg b/docs/thonny/pictures/image79.jpeg new file mode 100644 index 0000000..1ca3560 Binary files /dev/null and b/docs/thonny/pictures/image79.jpeg differ diff --git a/docs/thonny/pictures/image8.jpeg b/docs/thonny/pictures/image8.jpeg new file mode 100644 index 0000000..76156ca Binary files /dev/null and b/docs/thonny/pictures/image8.jpeg differ diff --git a/docs/thonny/pictures/image80.jpeg b/docs/thonny/pictures/image80.jpeg new file mode 100644 index 0000000..f037c90 Binary files /dev/null and b/docs/thonny/pictures/image80.jpeg differ diff --git a/docs/thonny/pictures/image81.jpeg b/docs/thonny/pictures/image81.jpeg new file mode 100644 index 0000000..571c178 Binary files /dev/null and b/docs/thonny/pictures/image81.jpeg differ diff --git a/docs/thonny/pictures/image82.jpeg b/docs/thonny/pictures/image82.jpeg new file mode 100644 index 0000000..e791c92 Binary files /dev/null and b/docs/thonny/pictures/image82.jpeg differ diff --git a/docs/thonny/pictures/image83.jpeg b/docs/thonny/pictures/image83.jpeg new file mode 100644 index 0000000..980877d Binary files /dev/null and b/docs/thonny/pictures/image83.jpeg differ diff --git a/docs/thonny/pictures/image84.jpeg b/docs/thonny/pictures/image84.jpeg new file mode 100644 index 0000000..fc56246 Binary files /dev/null and b/docs/thonny/pictures/image84.jpeg differ diff --git a/docs/thonny/pictures/image85.jpeg b/docs/thonny/pictures/image85.jpeg new file mode 100644 index 0000000..f36be65 Binary files /dev/null and b/docs/thonny/pictures/image85.jpeg differ diff --git a/docs/thonny/pictures/image86.jpeg b/docs/thonny/pictures/image86.jpeg new file mode 100644 index 0000000..0887ece Binary files /dev/null and b/docs/thonny/pictures/image86.jpeg differ diff --git a/docs/thonny/pictures/image87.jpeg b/docs/thonny/pictures/image87.jpeg new file mode 100644 index 0000000..3538815 Binary files /dev/null and b/docs/thonny/pictures/image87.jpeg differ diff --git a/docs/thonny/pictures/image88.jpeg b/docs/thonny/pictures/image88.jpeg new file mode 100644 index 0000000..a1c488c Binary files /dev/null and b/docs/thonny/pictures/image88.jpeg differ diff --git a/docs/thonny/pictures/image89.jpeg b/docs/thonny/pictures/image89.jpeg new file mode 100644 index 0000000..52ed5b1 Binary files /dev/null and b/docs/thonny/pictures/image89.jpeg differ diff --git a/docs/thonny/pictures/image9.jpeg b/docs/thonny/pictures/image9.jpeg new file mode 100644 index 0000000..030929d Binary files /dev/null and b/docs/thonny/pictures/image9.jpeg differ diff --git a/docs/thonny/pictures/image90.jpeg b/docs/thonny/pictures/image90.jpeg new file mode 100644 index 0000000..6620a88 Binary files /dev/null and b/docs/thonny/pictures/image90.jpeg differ diff --git "a/docs/thonny/thonny\345\274\200\345\217\221\347\216\257\345\242\203\351\205\215\347\275\256.md" "b/docs/thonny/thonny\345\274\200\345\217\221\347\216\257\345\242\203\351\205\215\347\275\256.md" new file mode 100644 index 0000000..57c743f --- /dev/null +++ "b/docs/thonny/thonny\345\274\200\345\217\221\347\216\257\345\242\203\351\205\215\347\275\256.md" @@ -0,0 +1,290 @@ +# 开发环境配置 + +## 一、下载安装Thonny + +------ + +Thonny是一个免费、开源的软件平台,体积小,界面简单,操作简单,功能丰富,是一个适合初学者的Python IDE。在本教程中,我们使用 Thonny 这个IDE在整个实验课程过程中开发ESP32。Thonny支持多种操作系统,包括Windows, Mac OS, Linux。 + +### 1.1 Windows系统 + +(1)软件下载和开源代码库分享 + +- [Thonny的开源代码库](https://github.com/thonny/thonny) +- [Thonny软件官网](https://thonny.org/)(请根据您的操作系统选择相应的选项下载安装) + + 下载好后,鼠标触碰到下图箭头所示处,会出现Windows官方下载的版本选择。请根据您的操作系统选择相应的版本下载。最好下载最新版,否则可能不支持ESP32。 + +![image6](pictures\image6.jpeg) + +![image7](pictures\image7.jpeg) + +(2)下载完成后,鼠标左键双击“thonny-4.0.2.exe”。出现“Select Setup Install Mode”对话框,选择“Install for all users”。你也可以选择“**Install for me only**”进行操作。 + +![image9](pictures\image9.jpeg) + +(3)如果你不熟系电脑软件的安装,可以一直单击“**Next**”直至安装完成。 + +![image10](pictures\image10.jpeg) + +(4)Thonny软件的安装路径。默认此安装路径继续下一步,单击“**Next**”。如果您想选择一个不同的文 +件夹,请单击“**Browse...**”进行修改。 + +![image11](pictures\image11.jpeg) + +(5)程序将在下面的开始菜单文件夹中创建程序的快捷方式。默认此文件夹继续下一步,单击“**Next**”。如果您想选择一个不同的文件夹,请单击“**Browse...**”。 + +![image12](pictures\image12.jpeg) + +(6)选中“**Creak desktop icon**”,在桌面生成快捷方式。 + +![image13](pictures\image13.jpeg) + +(7)单击“**Install**”安装软件。等待安装成功。 + +![image14](pictures\image14.jpeg) + +(8)安装完成,单击“**Finish**”结束安装。 + +![image15](pictures\image15.jpeg) + +### 1.2 Mac系统 + +鼠标触碰到下图箭头所示处,会出现MacOS的官方下载的版本选择。请根据您的操作系统选择相应的版本下载。最好下载最新版,否则可能不支持ESP32。 + +安装步骤请参考 **章节 1.1** 。 + +![image16](pictures\image16.jpeg) + +## 二、 Thonny软件基本配置与介绍 + +### 2.1 Thonny软件基本配置 + +(1)双击桌面的Thonny软件图标 ,出现语言选择和初始设置界面。 + +![image19](pictures\image19.jpeg) + + Language 选择“**简体中文**”。然后单击“**Let's go!**”结束设置。 + +![image20](pictures\image20.jpeg) + +![image21](pictures\image21.jpeg) + +(2)单击“**视图**”,勾选“**Shell**”和“文件” + +![image22](pictures\image22.jpeg) + +### 2.2 Thonny软件的介绍 + +### (1)工具栏介绍 + +![image23](pictures\image23.jpeg) + +| 按钮 | 功能 | +| --------------------------------- | ----------------- | +| ![image24](pictures\image24.jpeg) | 新建 | +| ![image25](pictures\image25.jpeg) | 打开 | +| ![image26](pictures\image26.jpeg) | 保存 | +| ![image27](pictures\image27.jpeg) | 运行当前脚本 | +| ![image28](pictures\image28.jpeg) | 调试当前脚本 | +| ![image29](pictures\image29.jpeg) | 步过 | +| ![image30](pictures\image30.jpeg) | 步进 | +| ![image31](pictures\image31.jpeg) | 步出 | +| ![image32](pictures\image32.jpeg) | 恢复执行 | +| ![image33](pictures\image33.jpeg) | 停止/重启后端进程 | + +### (2)界面介绍 + +![image34](pictures\image34.jpeg) + +## 三、 安装驱动 + +### 3.1 Windows系统 + +参考ESP32 IOT说明文档的驱动安装步骤。 + +### 3.2 Mac系统 + +请参考以下链接: + +https://www.wch.cn/downloads/CH341SER_EXE.html + +![image44](pictures\image44.jpeg) + +## 四、烧录固件 + +要在ESP32主板上运行Python程序,我们需要先将固件烧入到ESP32主板。 + +### 4.1 下载Micropython固件 + +- [microPython官方网站](http://micropython.org/) +- [microPython的ESP32固件](https://micropython.org/download/esp32/) 打开microPython的ESP32固件网址,下载固件。 + +![image48](pictures\image48.jpeg) + +本教程中使用的固件是:**esp32-20230426-v1.20.0.bin** 。我们的资料中也提供了此版本的固件,路径如下图。 + +![image49](pictures\image49.jpeg) + +### 4.2 烧录Micropython固件 + +(1)将ESP32主板通过Type-C线连接到计算机。 + +![image50](pictures\image50.jpeg) + +(2)确保驱动程序已成功安装,并能正确识别COM端口。打开设备管理器并展开“端口”。(端口号不是固定的COM6,会有不同,是正常情况。) + +![image51](pictures\image51.jpeg) + +(3)打开Thonny,点击“**运行**” ,选择 “**配置解释器**”。 + +![image52](pictures\image52.jpeg) + +在解释器页面,解释器选择“**Micropython (ESP32)**”,端口或WebREPL选择“**USB-SERIAL CH340 COM6)**”(COM号以你电脑的端口为准)。然后单击“安装或更新MicroPython”。 + +![image53](pictures\image53.jpeg) + +弹出“ESP32 firmware installer”页面,“**Port**”下拉选择“**USB-SERIAL CH340(COM6)**”。“**Firmware**”单击“**Browse...**”,选择下载好的microPython固件 “**esp32-20230426-v1.20.0.bin**”。检查“**Flash mode**”是否选择了“**From image file(Keep)**”,“**Erase flash before installing**”是否勾选。最后,单击“**安装**”,等待安装完成提示。 + +![image54](pictures\image54.jpeg) + +(4)安装完成,单击“**关闭**”。 + +![image55](pictures\image55.jpeg) + +在“Thonny 选项”页面单击“**好的**”。 + +![image56](pictures\image56.jpeg) + +(5)点击 “**停止/重启后端进程**”按钮。 + +![image58](pictures\image58.jpeg) + +现在,一切准备工作都已就绪。 + +**注意:**由于Thonny版本不同,在烧录的第3步可能出现以下不能更新的情况。 + +![image53](pictures\image53.jpeg) + +![image88](pictures\image88.jpeg) + +出现这种情况,点击以下按钮就能出现正常界面。 + +![image89](pictures\image89.jpeg) + +![image90](pictures\image90.jpeg) + +然后参照3-5的步骤继续烧录固件。 + +## 五、测试 + +### 5.1 测试Shell命令 + +在“**Shell**”窗口中输入“**print('hello world**')”,然后按下**Enter**键。 + +![image61](pictures\image61.jpeg) + +### 5.2 在线运行 + +ESP32需要连接到计算机时,是在线运行的。用户可以使用Thonny编写和调试程序。 + +(1)打开Tonny并单击![image62](pictures\image62.jpeg) ,然后单击“**此电脑**”。 + +![image63](pictures\image63.jpeg) + +(2)在弹出的页面选择路径“**基础输入模块\01 HelloWorld\MicroPython**”下的“**lesson_01_HelloWorld.py**“Python 文件,然后单击”**打开**“。 + +![image64](pictures\image64.jpeg) + +(3)单击![image65](pictures\image65.jpeg)或按下“F5”键,Shell窗口将打印出”**Hello World**“。 + +![image66](pictures\image66.jpeg) + +**注意:**如果在线运行时,按下ESP32的复位键,用户的代码将不会再次执行。如果你希望在重置代码后自动运行该代码,请参考下面章节 **5.3 离线运行** 的内容。 + +### 5.3 离线运行 + +ESP32复位后,首先运行根目录下的boot.py文件,然后运行你的代码文件,最后进入“Shell”。因此,为了让ESP32在重置后执行用户程序,我们需要在boot.py中添加一个引导程序来执行用户代码。 + +(1)打开Thonny,在文件管理框单击“**此电脑\文件夹所在位置\sp32-iot-kit\基础输入模块\00 Boot\MicroPython 程序**”。 + +![image68](pictures\image68.jpeg) + +(2)展开“**00 Boot**”,然后鼠标左键双击“**boot.py**”,使 “**MicroPython 设备**”中的程序能够离线运行。 + +![image69](pictures\image69.jpeg) + +(3)如果想让编写的程序离线运行,需要上传我们提供的“**boot.py**”和你编写的程序代码到“**MicroPython 设备**”,然后按下ESP32的复位按键。 +展开文件夹 00 Boot。右键单击“**boot.py**”,选择“**上传到/**”。 + +![image70](pictures\image70.jpeg) + +![image71](pictures\image71.jpeg) + +![image78-2](pictures\image78-2.jpeg) + +单击“**确定**”。 + +![image72](pictures\image72.jpeg) + +(4)同样,将“**lesson_01_HelloWorld.py**”上传到 “**MicroPython 设备**”。 + +![image73](pictures\image73.jpeg) + +可以在 “**MicroPython 设备**”看到代码已成功上传。 + +![image74](pictures\image74.jpeg) + +(6)按下ESP32的**Reset按键**,在Shell窗口中能看到代码被执行。 + +![image75 ](pictures\image75 .jpeg) + + + + + +![image76](pictures\image76.jpeg) + +## 六、Thonny常见的操作 + +### 6.1 上传代码到ESP32 + +为了方便起见,我们以**boot.py**为例。如果我们在每个代码目录中都添加了boot.py。ESP32每次重启时,它将首先执行根目录中的“**boot.py**”。 + +在00 Boot文件夹中选择“**boot.py**”,右键单击鼠标,选择“**Upload to** /”将代码上传到ESP32的根目录,然后选择“**确定**”。 + +![image78](pictures\image78.jpeg) + +### 6.2 下载代码到电脑 + +在“**MicroPython 设备**”内选中“**boot.py**”,右键选择“**下载到 D:\代码**”把代码下载到你的电脑里。 + +![image79](pictures\image79.jpeg) + +### 6.3 删除ESP32根目录下的文件 + +在“**MicroPython 设备**”内选中“**boot.py**”,右键单击它且选择“**删除**”,将“**boot.py**”从ESP32的根目录中删除。 + +![image80](pictures\image80.jpeg) + +### 6.4 创建并保存代码 + +单击“**文件**”,然后选择“**新建**”。 + +![image82](pictures\image82.jpeg) + +在新打开的文件中输写代码。 + +![image83](pictures\image83.jpeg) + +单击菜单栏上的![image84](pictures\image84.jpeg) ,可以将代码保存到你的电脑或ESP32上。这里选择保存到“MicroPython 设备”。 + +![image85](pictures\image85.jpeg) + +文件名命名为“**main.py**”,然后单击“**好的**”。 + +![image86](pictures\image86.jpeg) + +代码已经上传到ESP32。 + +![image87](pictures\image87.jpeg) \ No newline at end of file