You can write MicroPython applications for the XBee 3 BLU device using any text editor or Python IDE and manually deploy them to the XBee device. However, Digi provides the Digi XBee PyCharm IDE plugin, a specialized extension for the PyCharm IDE that significantly streamlines this process, making development more efficient and intuitive.

Develop a MicroPython application with the Digi XBee PyCharm IDE plugin

The Digi XBee PyCharm IDE plugin offers seamless integration with Digi’s XBee modules, allowing you to easily create new MicroPython projects or import existing samples and launch them on XBee devices. With this plugin, you also benefit from features like code completion and access to XBee-specific MicroPython libraries.

Once your application is ready, the plugin enables you to build and upload your MicroPython project to the XBee 3 BLU device with a single click.

This section walks you through creating and launching a simple MicroPython application that blinks the user LED on the XBIB-C of your XBee 3 BLU device.

For more information about the Digi XBee PyCharm IDE plugin, refer to the Digi XBee PyCharm IDE Plugin User Guide.

1. Install the Digi XBee PyCharm IDE plugin

Follow these steps to install PyCharm and the Digi XBee PyCharm IDE plugin:

  1. Download and install the latest version of PyCharm Community Edition from the PyCharm download page.

  2. Execute PyCharm.

  3. Go to the Plugins window by doing one of the following:

    • On the Welcome screen select Plugins.

    • Or, from the main menu, select File > Settings, and then click Plugins.

  4. In the Marketplace search box, type Digi XBee. The Digi XBee plugin should appear and selected by default.

  5. Click Install.

  6. When finished, click Restart IDE to complete the plugin installation.

2. Import the 'Blinking LED' sample

After installing PyCharm and the Digi XBee PyCharm IDE plugin, you can create a new MicroPython application from scratch or base your application on an existing sample. In this guide, you will import the Blinking LED sample:

  1. Launch PyCharm.

  2. Import the sample project by:

    • On the Welcome screen, click New Digi Project and select Import Digi Sample.

    • Or, from the main menu, choose File > Import Digi Sample Project.

  3. In the Import Digi Sample, select the XBee module category and click Next. The platform list displays.

  4. Select the Digi XBee 3 BLU platform and click Next. The samples list displays.

  5. Select the Blinking LED sample under the GPIO category and click Next. The project configuration view displays.

  6. Leave all the settings with their default values and click Create.

  7. The Blinking LED sample is imported and PyCharm displays the README of the example.

3. Test the 'Blinking LED' sample

To run and test the Blinking LED MicroPython sample:

  1. In the toolbar of PyCharm click the Play (green triangle) button. A warning appears, asking you to select the target XBee device.

  2. Click OK. The XBee Device Selector dialog opens.

  3. Select the Local PC category to search for XBee devices and click Next.

  4. Wait for your XBee 3 BLU device to be discovered.

  5. Select your XBee 3 BLU device and click OK.

    If your device is not in MicroPython REPL mode, you will be prompted to configure it. Click Yes to set it automatically.
  6. Wait for the MicroPython application to be automatically transferred and executed on your XBee 3 BLU device.

  7. The application is transferred and executed on the XBee 3 BLU device. The MicroPython REPL Console view displays the output of the application, similar to:

    soft reboot
    Loading /flash/main.mpy...
    Running bytecode...
     +--------------------------------------+
     | XBee MicroPython Blinking LED Sample |
     +--------------------------------------+
    
    - LED OFF
    - LED ON
    - LED OFF
    - LED ON
    1. Verify that the user LED on the XBIB-C development board is blinking.

Develop a MicroPython application without the Digi XBee PyCharm IDE plugin

If you prefer not to use the Digi XBee PyCharm IDE plugin, you can still manually develop and deploy MicroPython applications following the steps below:

  1. Write your MicroPython application using your preferred Python IDE or text editor.

    Refer to the Digi MicroPython Programming Guide for information about the APIs supported by the XBee devices.
  2. Rename the application to main.py.

  3. Transfer the application and required libraries to the root of the XBee 3 BLU device’s file system using XBee Studio.

  4. Configure the PS AT command with 1 (enabled) using XBee Studio so that the MicroPython application starts automatically when the device boots.

  5. Open the MicroPython Terminal view of your XBee device in XBee Studio and connect it.

  6. Reset your XBee module. The MicroPython application starts automatically and the MicroPython Terminal within XBee Studio displays the output of the application.

For more information about how to manage the file system of your XBee device, configure it, and access the MicroPython Terminal, refer to the Manage the XBee 3 BLU chapter.