# PlatformIO

PlatformIO provides great tools to easily get started with your development board. As we want the SDK to be easily accessible, we made it a PlatformIO library.

PIO is running on top of VSCode so make sure to have [VSCode](https://code.visualstudio.com/download) and [install PlatformIO](https://platformio.org/install/ide?install=vscode).

## From source code repository

If you've downloaded the [source from Github](https://github.com/vertices-network/c-vertices-sdk), the easiest way to get started is to open the example available 🚀

On VSCode, go to the PlatformIO tab > open a project (PIO Home > Open > Open Project) and open the example at that location:

```
path/to/c-vertices-sdk/examples/esp32
```

You will then need to fetch the dependencies such as the Espressif Framework. Click on the `build` button to get the packages and then, head to the [Configure](https://docs.vertices.network/vertices-sdk/quickstart/microcontrollers/platformio#configure) paragraph as we have some configuration to be made. 🛠

## Using an existing project

If you have created a project using PlatformIO, you will only need to install the library.&#x20;

### Install the Vertices SDK

Go to the **Libraries** tab and search for `vertices-sdk`. You should find the library in its latest version, click **Add to Project,** and select your project

![The Vertices SDK in PlatformIO](https://3444584021-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY5cgxyYAI0pHdVffOt%2F-Ma-Gb0TCEJsApCsKWSB%2F-Ma-H33eE31dll8y1lLm%2FScreenshot%202021-05-18%20at%2014.45.55.png?alt=media\&token=2b7db8ae-17ac-410c-9f14-1632473d80a5)

You can then use the files provided in the **Examples** tab to easily get started.

## Configure

### WiFi

The example provided with the SDK is based on a WiFi example so you need to configure the WiFi credentials to have the board connect to the Internet.

From `PlatformIO > Project Tasks > esp32-example > Platform`, click on `Run Menuconfig`. If you don't have the `Platform` tab, it probably means that you didn't install the Espressif32 platform yet. Try to `build` the project to force PlatformIO to get the packages.

You'll then be able to set the WiFi router SSID and password. Navigate to `Example Connection configuration` > `WiFi SSID` and `WiFi Password` to set the parameters. Then save ( type `S`) and exit (`Q`).

![](https://3444584021-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MY5cgxyYAI0pHdVffOt%2F-MaSkQrW5sCZ0UvRbdI-%2F-MaSnjRqnPdPZOgxVPGm%2Fimage.png?alt=media\&token=411b9603-8047-4099-99fd-8890d2b703dd)

You should now be able to build and run the example using `Build`, `Upload` and `Monitor` buttons.&#x20;

## Monitor

Once built, you'll be able to monitor the example using the Monitor button on PlatformIO. A terminal will then be opened and the serial interface will be printed:

```
[...]
I (6705) vertices_example: Connected to AP, begin http example
I (6715) vertices_example: 💳 Alice's account E3PGTXKDOODVQ3E2ZB5PMJF2W3YOKIPUPLFDTESSP6562QE4GTLAKO4VXY
I (6725) http_esp: HTTP init: https://api.testnet.algoexplorer.io
I (9475) http_esp: HTTP GET Status = 200, content_length = 5
I (9745) http_esp: HTTP GET Status = 200, content_length = 232
I (9755) vertices_example: 🏎 Running on testnet-v1.0 v.2.5.0
🟢 [/Users/cyril/Documents/work/vertices/c-vertices-sdk/src/account.c:42] 👛 Added account to wallet: #0
I (9985) http_esp: HTTP GET Status = 200, content_length = 27
I (9995) vertices_example: 🤑 10.968642 Algos on Alice's account (E3PGTXKDOODVQ3E2ZB5PMJF2W3YOKIPUPLFDTESSP6562QE4GTLAKO4VXY)
🟢 [/Users/cyril/Documents/work/vertices/c-vertices-sdk/src/account.c:42] 👛 Added account to wallet: #1
I (10135) http_esp: HTTP GET Status = 200, content_length = 27
I (10525) http_esp: HTTP GET Status = 200, content_length = 249
I (10585) http_esp: Adding header: Content-Type: 
I (11025) http_esp: HTTP POST Status = 200, content_length = 64
🟢 [/Users/cyril/Documents/work/vertices/c-vertices-sdk/src/algorand/algorand_transaction.c:307] 🧾 Transaction executed, ID: AMBREJ5C6OLZHT3ZEITT5ROSO3N5QTENSS6QKFFE4V7YAPOVW6RA
W (11055) vertices_example: Unhandled event: 2
I (11055) vertices_example: 💸 Alice sent 0.000100 algo to Bob
🟢 [/Users/cyril/Documents/work/vertices/c-vertices-sdk/src/account.c:89] 👛 Deleted account from wallet: #0
🟢 [/Users/cyril/Documents/work/vertices/c-vertices-sdk/src/account.c:89] 👛 Deleted account from wallet: #1

```
