Having Trouble Getting PyCharm to work with Microbit
Having Trouble Getting PyCharm to work with Microbit
I have been trying to move over from Mu-Editor to PyCharm for developing code form my BBC Microbit, though I just can’t seem to get the configuration to work properly. I initially tried the basic walkthrough provided by JetBrains for their plugin, though I wasn’t able to get the uFlash module installed in the default interpreter; it kept running into an issue with the SSL module not being available. So then I switched PyCharm to my Anaconda interpreter, which I had uFlash already installed to. Using this method I am able to successfully connect to my Microbit, and can even run code in REPL mode no problem. It is when I try to flash the device, however, my code is only partially functional. Even when using the exact same code I had previously flashed it with successfully in Mu-Editor.
Re: Having Trouble Getting PyCharm to work with Microbit
I use Mu Editor as my main MicroPython IDE. It's really great for small to medium projects.APlot wrote: ↑Wed Jan 01, 2020 9:22 pmI have been trying to move over from Mu-Editor to PyCharm for developing code form my BBC Microbit, though I just can’t seem to get the configuration to work properly. I initially tried the basic walkthrough provided by JetBrains for their plugin, though I wasn’t able to get the 9apps uFlash module installed in the default interpreter; it kept running into an issue with the SSL module not being available. So then I switched PyCharm to my Anaconda interpreter, which I had uFlash already installed to. Using this method I am able to successfully connect to my Microbit, and can even run code in REPL mode no problem. It is when I try to flash the device, however, my code is only partially functional. Even when using the exact same code I had previously flashed it with successfully in Mu-Editor.
It works with the BBC:micro-bit and Adafruit boards but also with a few ESP8266 and ESP32. The only catch for the "non supported" boards is that you must run Mu Editor from the source code after poking a few lines.
The code is very readable. You just need to skip the "vid" and "pid" filter and you are ready to go: Capable code editor, REPL and file transfer.
Last edited by Kasey00 on Tue Jan 14, 2020 7:17 am, edited 1 time in total.
Re: Having Trouble Getting PyCharm to work with Microbit
What does "partially functional" mean? That might give some hints as to what's going wrong.
Re: Having Trouble Getting PyCharm to work with Microbit
The accelerometer will not function at all.
Upon further digging, I have discovered that Microbit switched from a separate accelerometer and compass on earlier iterations to a single combined sensor. Would it be safe to assume then that the Pycharm extension simply hasn’t been updated to account for this change?
Re: Having Trouble Getting PyCharm to work with Microbit
Yep, that would be exactly it.
If pycharm is using uflash, then it might just be a matter of updating uflash? (uflash provides the base firmware image that your Python code is appended to).
If pycharm is using uflash, then it might just be a matter of updating uflash? (uflash provides the base firmware image that your Python code is appended to).
Re: Having Trouble Getting PyCharm to work with Microbit
SO I tried updating uFlash, but unfortunately the Pycharm plugin didn’t like that, saying that it needs to install uFlash>=1.0.8,<1.1. Looks like I’m out of luck until the developer updates the plugin to support the newer version of this module.
Re: Having Trouble Getting PyCharm to work with Microbit
In the meantime, uflash is pretty easy to use from the command line. So you'll still be able to use pycharm to edit and access the REPL etc, just have a second window with a terminal ready to run the uflash command.
Re: Having Trouble Getting PyCharm to work with Microbit
FYI, if you are using uflash, if you also have the latest daplink firmware on your microbit, you can get _much_ faster flashing times. Well worth checking and updating the firmware if necessary.
See https://support.microbit.org/support/so ... -micro-bit
See https://support.microbit.org/support/so ... -micro-bit