Wemos & MicroPython

#Tutorial: Installing dependencies on MicroPython


While I was reading my getting stated tutorial about MicroPython again, I noticed that I've forgotten to tell something about dependencies or packages.

Here is possible to find some MicroPython packages. On the WeMos or the ESP8266, it is possible to install these packages using the upip package manager. The WiPy doesn't have the package.

To download the new packages, you need to connect the board to the Internet. I take the WeMos as example and typing the following, you can connect the board to your WiFi router:

ssid_ = <your_ssid>
wp2_pass = <your wpa2 password>

import network
sta_if = network.WLAN(network.STA_IF)

sta_if.active(True)
sta_if.connect(ssid_, wp2_pass)
print(sta_if.isconnected())

Then, to install a package, simple type the following, the results are shown on Fig. 1.

import upip
upip.install('notes-pico')
upip install notes-pico
Fig. 1: Installing notes-pico using the package manager upip.

A lot of packages listed on pypi are dummy packages. That means, they are empty. Installing packages on the ESP8266 is really difficult because of the limited RAM. You usually get the memory allocation error.

{{ message }}

{{ 'Comments are closed.' | trans }}