PyCharm 如何支持 MicroPython 并实现 REPL

PyCharm 如何支持 MicroPython 并实现 REPL

TONYLABS 19 Jul, 2019

首先打开 PyCharm 欢迎界面,选择已创建的项目或新建项目。

如上图所示,Python 运行环境无需做任何更改,前提是已经过装过 Python 和 Virtualenv,可根据自己的喜好选择虚拟环境。给项目起个名字,选择编译环境,点击 Create 创建项目。

成功创建项目后,Mac 系统下打开 PyCharm Preferences,Windows 即打开 Settings,选择 Plugins(插件)选项卡,输入 micropython 搜索插件并安装,安装后会提示重启 PyCharm。

PyCharm 重启后,会提示需要安装 pyserial 串口支持,点击提示蓝右侧 Install requirements,安装后仍然需要重新启动 PyCharm。

PyCharm 重启后,将 PyBoard 与电脑链接,再次打开 Preferences(Mac)或 Settings(Windows)界面,选择 Languages & Frameworks 选项卡,选择 MicroPython,勾选 Enable MicroPython Support,设备类型(Device Type)中选择 PyBoard。最后点击 Detect,自动识别 PyBoard USB 设备端口,并点击 OK,至此 PyCharm 已实现 REPL 软件设置。

回到项目界面,选择 Tools 中 MicroPython 菜单下的 MicroPython REPL,注意下方终端窗口。

这里我们写了一个读取板载加速计的读取脚本,成功得到结果。 比起使用 Putty REPL 方式调试代码要方便的多。希望大家受用。

Like what you're reading? Subscribe to our top stories.

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Medium, Twitter, Facebook, YouTube, and Dribbble.

Image Description
Written by

Hanna Wolfe

I create advanced website builders made exclusively for web developers.


  • Image Description
    Dave Austin 1 day ago

    As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

    • Image Description
      Hanna Wolfe 1 day ago

      Love it Dave! We're all about keeping it up.

  • Image Description
    Christina Kray 2 days ago

    Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.


Post a comment

Stay in the know

Get special offers on the latest developments from Front.