Express Boards
If you are using a Feather M0 Express, Metro M0 Express or Circuit Playground Express (or any other "Express" board)
your CircuitPython board comes with at least 2 MB of Flash storage. This is
plenty
of space for all of our library files so
we recommend you just install them all! (If you have a Gemma M0 or Trinket M0 or other non-Express board, skip
down to the next section)
On Express boards, the
lib
and
examples
directories can be copied directly to the CIRCUITPY drive.
Just drag the entire
lib
and
examples
(optional) folders into the CIRCUITPY drive, and 'replace' any old files if your
operating system prompts you.
To use any of the supplied example files, from either the REPL or inside a code.py/main.py, simply import them using
the filename:
Non-Express Boards
If you are using Trinket M0 or Gemma M0, you will need to load the libraries individually, due to file space
restrictions. If you are using a non-express board, or you would rather load libraries as you use them, you'll first want to
create a
lib
folder on your
CIRCUITPY
drive. Open the drive, right click, choose the option to create a new folder, and
call it
lib
. Then, open the
lib
folder you extracted from the downloaded zip. Inside you'll find a number of folders and
.mpy
files. Find the library you'd like to use, and copy it to the lib folder on CIRCUITPY.
This also applies to example files. They are only supplied as raw
.py
files, so they may need to be converted to
.mpy
using the mpy-cross utility if you encounter
MemoryError
s. This is discussed in the
CircuitPython Essentials
Guide
(https://adafru.it/CTw)
. Usage is the same as described above in the Express Boards section. Note: If you do not
place examples in a separate folder, you would remove the
examples.
from the import statement.
Example:
ImportError
Due to Missing Library
If you choose to load libraries as you need them, you may write up code that tries to use a library you haven't yet
loaded. We're going to demonstrate what happens when you try to utilise a library that you don't have loaded on your
board, and cover the steps required to resolve the issue. This demonstration will only return an error if you do not
have the required library loaded into the
lib
folder on your
CIRCUITPY
drive.
Let's use a modified version of the blinky example.
import examples.adxl34x_simpletest
© Adafruit Industries
https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51
Page 66 of 183
Содержание Feather M4 Express
Страница 1: ...Adafruit Feather M4 Express Created by lady ada Last updated on 2019 03 04 10 41 14 PM UTC...
Страница 5: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 10 of 183...
Страница 58: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 63 of 183...
Страница 164: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 169 of 183...
Страница 168: ...Adafruit Industries https learn adafruit com adafruit feather m4 express atsamd51 Page 173 of 183...