diff --git a/content/micropython/02.environment/03.modules/assets/package-installer.png b/content/micropython/02.environment/03.modules/assets/package-installer.png new file mode 100644 index 0000000000..7a6484181f Binary files /dev/null and b/content/micropython/02.environment/03.modules/assets/package-installer.png differ diff --git a/content/micropython/02.environment/03.modules/assets/usb-comp.png b/content/micropython/02.environment/03.modules/assets/usb-comp.png new file mode 100644 index 0000000000..7b2c209e82 Binary files /dev/null and b/content/micropython/02.environment/03.modules/assets/usb-comp.png differ diff --git a/content/micropython/02.environment/03.modules/modules.md b/content/micropython/02.environment/03.modules/modules.md index cb51ba3d7c..3339394761 100644 --- a/content/micropython/02.environment/03.modules/modules.md +++ b/content/micropython/02.environment/03.modules/modules.md @@ -4,8 +4,6 @@ description: 'Understanding modules in MicroPython and how to use them.' author: 'Pedro Lima' tags: [MicroPython, Modules] --- - - In this guide, we’ll cover how modules work in MicroPython, explore a few built-in modules, and demonstrate how to install an external package like Modulino to extend our MicroPython project’s functionality. ## What Are Modules? @@ -55,39 +53,59 @@ Before we can install external modules, we need to have MicroPython running on o ### Step 2: Install the Modulino Package -To install the Modulino package, we’ll use `mpremote`, a tool that allows us to install MicroPython packages directly onto our board from the command line. +There are multiple ways to install external modules in MicroPython. We’ll cover two common methods: +- **Using the MicroPython Package Installer (GUI)** (Recommended for ease of use) +- **Using `mpremote` (Command-line installation)** + +#### Option 1: Using the MicroPython Package Installer (Recommended) +The **MicroPython Package Installer** is a graphical tool that makes it easy to install external modules without needing to use the command line. + +1. **Download and install** the [MicroPython Package Installer](https://github.com/arduino/lab-micropython-package-installer/releases). +2. **Open the tool** and plug in your board. +![Board connected via USB](assets/usb-comp.png) + +If the board does not appear in the `Detected Boards` section, click `Reload`. +If the board is still not detected, ensure no other programs (e.g., a code editor) are using the board's COM port. + +3. **Search for the Modulino package** using the search feature. +4. Click **Install** and wait for the installation confirmation. +5. **Disconnect the board** from the tool before returning to your code editor to avoid conflicts due to the COM port being busy. + +![Package Installer UI](assets/package-installer.png) -1. Make sure Python is installed on your computer -2. Open a terminal on your machine. -3. Run the following command to install `mpremote`. +#### Option 2: Using `mpremote` (Command Line Installation) +For those who prefer the command line, we can use `mpremote`, a Python tool that allows direct installation from the terminal. + +1. Make sure **Python** is installed on your computer. +2. Open a terminal and install `mpremote` with: ```bash pip install mpremote - ``` + ``` -4. With `mpremote` installed, run the following script to find our board's serial port. +3. Run the following command to find your board's serial port: ```bash mpremote connect list - ``` + ``` - This command should return something akin to: + Example output: - ```bash + ``` /dev/cu.usbmodem101 ecda3b60a4dccb3f 2341:056b Arduino Nano ESP32 ``` - - Copy the port, e.g., `/dev/cu.usbmodem101`. + - Copy the **port**, e.g., `/dev/cu.usbmodem101`. -5. Use the following command to install the Modulino package (or any other package we want to install), replacing `` with our board’s port retrieved in the previous step. +4. Use the following command to install the Modulino package (or any other package), replacing `` with your board’s serial port: ```bash mpremote connect mip install github:arduino/arduino-modulino-mpy ``` -6. After the installation, open Arduino Labs for MicroPython, and connect your board. In the board's files, we should see a `/lib` folder with the Modulino library inside, indicating a successful installation. +5. After installation, open **Arduino Labs for MicroPython** and connect your board. You should see a `/lib` folder with the Modulino library inside, confirming a successful installation. - ![MicroPython Lab Files](./assets/microPythonLabsFiles.png) +![MicroPython Lab Files](./assets/microPythonLabsFiles.png) ## Organizing and Using Modules diff --git a/content/micropython/05.modulinos/01.installation/assets/package-installer.png b/content/micropython/05.modulinos/01.installation/assets/package-installer.png new file mode 100644 index 0000000000..7a6484181f Binary files /dev/null and b/content/micropython/05.modulinos/01.installation/assets/package-installer.png differ diff --git a/content/micropython/05.modulinos/01.installation/assets/usb-comp.png b/content/micropython/05.modulinos/01.installation/assets/usb-comp.png new file mode 100644 index 0000000000..7b2c209e82 Binary files /dev/null and b/content/micropython/05.modulinos/01.installation/assets/usb-comp.png differ diff --git a/content/micropython/05.modulinos/01.installation/installation.md b/content/micropython/05.modulinos/01.installation/installation.md index 5b652ec985..f003731234 100644 --- a/content/micropython/05.modulinos/01.installation/installation.md +++ b/content/micropython/05.modulinos/01.installation/installation.md @@ -23,26 +23,28 @@ We will also need the following software: - [MicroPython Labs](https://lab-micropython.arduino.cc/) - [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer) - [Modulino MicroPython package](https://github.com/arduino/arduino-modulino-mpy) +- [MicroPython package installer](https://github.com/arduino/lab-micropython-package-installer/releases) ## Install MicroPython -To follow this tutorial, we will need to install MicroPython on our Arduino board. The easiest way is to install it using the [MicroPython Installer](https://labs.arduino.cc/en/labs/micropython-installer). -- Open the installer. -- Connect the board to the computer. -- If it does not appear press the refresh button. -- Press "Install MicroPython". -- Wait for the installation to finish. +### Option 1: Using the MicroPython Package Installer **(Recommended)** -![MicroPython Installer](./assets/microPythonInstaller.png) +The **MicroPython Package Installer** is a graphical tool that simplifies the installation of external modules without requiring command-line interaction. -***More details on installing MicroPython on our board are available in the [MicroPython installation guide](/micropython/first-steps/install-guide).*** +1. **Download and install** the [MicroPython Package Installer](https://github.com/arduino/lab-micropython-package-installer/releases). +2. **Open the tool** and plug in your board. -## Install Modulino Package +![Board connected via USB](assets/usb-comp.png) +If the board does not appear in the `Detected Boards` section, click `Reload`. +If the board is still not detected, ensure no other programs (e.g., a code editor) are using the board's COM port. +1. **Search for the Modulino package** using the search feature. +2. Click **Install** and wait for the installation confirmation. +3. **Disconnect the board** before returning to your code editor to avoid conflicts due to the COM port being busy. -To program Modulinos using MicroPython we must first install the Modulino package. It's where all the code, necessary to interact with the Modulinos is being stored. +![Package Installer UI](assets/package-installer.png) -### Terminal Installation +### Option 2: Terminal Installation To install a module, we can use `mpremote`. Currently, we will need a version of Python installed on our computer. @@ -63,7 +65,7 @@ To install a module, we can use `mpremote`. Currently, we will need a version of ``` The port here is `/dev/cu.usbmodem101`. Copy this. -1. Now, run the following the command. Make sure to replace `` with the port of our device obtained in the previous step. +3. Now, run the following the command. Make sure to replace `` with the port of our device obtained in the previous step. ```bash mpremote connect mip install github:arduino/arduino-modulino-mpy ``` @@ -71,7 +73,7 @@ To install a module, we can use `mpremote`. Currently, we will need a version of Upon completion, we should see something like this in the terminal, to verify the success of the installation: ![Successful installation.](assets/package-installed.png) -2. Great job. We have now installed the Modulino package on our board! +4. Great job. We have now installed the Modulino package on our board! **Troubleshooting:** - Make sure your board is connected to your computer.