In addition to updating the firmware, there is also a rich set of Python libraries called the CircuitPython Library that can also be updated with the latest supported features.
Updating the CircuitPython Library
Getting ready
Any of themethods used in the previous recipes can be used hereto obtain a REPL.
How to do it...
Let's have a look at how to do this:
- Open the REPL through your preferred application.
- Download the latest CircuitPython Library Bundle release (https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest). The name of the bundle file is adafruit-circuitpython-bundle-3.x-mpy-20190212.zip. Since our firmware is using the 3.x release, we must select the bundle that is also for the 3.x release. Always use the mpy version, as this is optimized to use less disk space and has reduced memory usage.
- Extract the .zip file to a location on your computer.
- If the CIRCUITPY drive does not contain a lib folder, then create one now.
- Copy the contents of the extracted lib folder into the lib folder on the device.
- Perform a soft reboot in the REPL by pressing Ctrl + D.
- Run import simpleio in the REPL.
- If it has executed successfully, then the libraries have been successfully loaded, as the simpleio module is not part of the firmware and was imported from the library folder.
How it works...
The lib path that was created is one of the standard paths the CircuitPython will look in when importing Python packages. By adding Python packages to this folder, this makes it available for import by any scripts running on the device.
The mpy files are built from the original source py files and bundled all together in one package to make it easier to install.
There's more...
The CircuitPython Library is under constant development, so it's important to know how to update the library on the board so that you can get the latest features. As you experiment with code from projects you find on the internet, you might occasionally find examples that don't work on your board because you are running an outdated version of the CircuitPython Library. Keep your board to the latest version, as this can help prevent this from happening.
See also
Here are a few references:
- For more details on how the mpy files are created, check out the mpy-cross command at https://learn.adafruit.com/building-circuitpython/build-circuitpython.
- Information on installing the CircuitPython Library Bundle is available at https://learn.adafruit.com/adafruit-circuit-playground-express?view=all#installing-the-circuitpython-library-bundle-12-5.