# Compiling the Code

This project uses Platform IO to build the firmware for the various boards. To get started you will need to download,

### Install Visual Studio Code

{% embed url="<https://code.visualstudio.com/download>" %}

{% hint style="info" %}
The default installation options are okay
{% endhint %}

### Add Platform IO Extension

![](/files/B4NYtwxWkBaih1rVm7cZ)

Choose install. **\*Wait for all the installation complete popup messages at the bottom\***. It can take a while to install, don't close or do anything else in the meantime.

The final message is please restart VSCode. Go ahead and Restart VSCode by clicking the **Reload Now** button.&#x20;

After it reboots you should see the PlatformIO icon on the bottom of the left tool bar (Alien Head)

### Clone the Git Repository or download + extract the .zip file from GitHub

{% embed url="<https://github.com/dlktdr/BTWifiModule>" %}

{% hint style="info" %}
I would suggest using an app like GitHub desktop to clone and keep up to date with changes if your not a command line GIT expert. Use <https://www.gihub.com/dlktdr/BTWifiModule> as the URL Clone source.
{% endhint %}

{% hint style="danger" %}
The folder cannot contain any spaces or you will get build issues. I suggest you put it in the root folder of a drive
{% endhint %}

### Build the Source

From VSCode Click the Platform IO Extension, You will be brought to a list of available boards. Click the drop down arrow on the board you want to build. **Be patient while it loads.** The first time will take a while while it installs and configures in the back end.

Click Build, This will start building the project

![](/files/wCeK4KNMWCNuJvts9D2m)

When it's done you should see a message,

![](/files/M3mqkzDey2xcj4jPGAkI)

You can see near the end of the output where the firmware file was written to. In the above case .pio/build/C3Mini/firmware.bin. This is the file that would be uploaded to the board.

#### Upload - PlatformIO has the ability to automatically upload the code to the board.

Choose **Upload** from the list will build and Upload to the board. Note if you have multiple Com ports on your PC, it might not be able to detect the correct one. Look in **platformio.ini** file, you can manually force the upload port here with **upload\_port=xxx.** There are a few examples in the file.

#### Upload and Monitor - This will upload and automatically open the COM port for diagnostic output.

The monitor port, which is usually the same as the programming port is specified in platformio.ini under **monitor\_port=** You should only have to specify this if it's not automatically detect.

#### Hopefully that will get you started. Looking forward to seeing those Pull Requests!<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://btwifimod.gitbook.io/untitled/developing/compiling-the-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
