4 Pycharm IDE programming

From Banana Pi Wiki
Revision as of 20:29, 18 February 2019 by Sinovoip (talk | contribs) (Use the Mpfshell directly)
Jump to: navigation, search

Install Python 3.7

Python02.png
  • the system already has Python.

Install the pycharm community version

  • Get pycharm
  • Using the Windows system click here to download the 2018 - version 2.3 (community free of charge)
  • Tip: 2018.3.3 change is too big, do not use, wait for me to compile repair. (2019/01/13)
  • Important note 1: program installation and project under Windows must be under the system disk (path should be consistent)
  • Important clew 2, Linux system if there is a serial connection, please kindly check whether the serial port for the average user permissions, if not sure, please check this instruction ` usermod - a - G dialout Username && sudo reboot `, Username is to point to your user name, not a Username.
  • When the installation is complete, open it. Press the default Settings to enter the following interface.
Python03.png

Create a new project

  • Click Create New Project to bring up the following interface.
Python05.png
  • If you do not have Python installed, here is the interface
Python06.png
  • Finally, you can see that the project has been established and completed.
Python07.png
    • Refer to the official documentation of pycharm for more methods

Install the MicroPython plug-in

  • Note: it is now recommended to use the intellij-mpfshell-1.1.1.1.zip plug-in version instead of the older version
  • releases in the release directory intellij micropython - 1.1.0. Zip the plugin file, and information about the plug-in inofficial introduction and official GIT
  • Download good ` intellij micropython - 1.1.0 ` plug-in, where you know, into the JetBrains pycharm Community Edition of File - > Settings - > plugins - > Install plugins from disk
Python08.png
Py08.png
  • Tip: I offer this plugin is a modified version at the bottom of the interface, and haven't access to the official store, so still and the original plugin name, therefore the IDE prompts plug-ins need to upgrade or other repair, will be replaced back to the original, in this case, it is good to ignore, then replace the plug-in names again issued can be directly connected to the Internet in the shop for download.
Py09.png
  • Latest revision: the latest intellij-mpfshell-1.1.1.1.zip is now available, which differs from the specified version above in that it cleanness unnecessary information display, the connection is more stable, also applies to esp8266, and plans to launch the store in the future.

Run a file

  • Once the plug-in is installed, start it in the project.
Py10.png
  • You can search for MicroPython in Settings to get the above page.
Py11.png
  • Now start it and click on the Settings in the figure, Enable MicroPython support.
Py12.png
  • Select ESP8266 (ESP32) to configure the device type, and click Detect to Detect the path (or name) of the board you are connecting to, which is bound to fail because the key dependencies are not yet installed.
Py13.png
  • When automatic serial port recognition fails, you need to fill in your own serial port name (including path) or other connection parameters, such as: ws:192.168.1.1,1234, which is the same as the open of mpfshell.
Py14.png
  • Now that you have set the connection parameters for the board, you can right click on a new python file from untitled and be sure to create a file to trigger the installation dependency the first time you use it, before using the auto-identification serial port and other Tools (Tools in the menu item).
Py15.png
  • In the right code edit box, say print(helloworld!)
Py16.png
  • The first time you use it, you'll be prompted to Install the dependencies, so click Install requirements in the message to download the installation automatically in the background
Py17.png
  • Just wait a moment
Py18.png
  • You will be prompted when the installation is complete.
Py19.png
  • Now we can Run the main.py file. Select Run 'Flash main.py' from the right-click menu anywhere in the edit box to automatically generate the Run file configuration and Run it on the board
Py20.png
  • You can see the results below
Py21.png

Use the Mpfshell directly

REPL and Mpfshell shortcuts are available in tools-> MicroPython.

Py22.png

Functional specification