> For the complete documentation index, see [llms.txt](https://cavedu.gitbook.io/linkit-7697/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cavedu.gitbook.io/linkit-7697/linkit-7697-development-guide-for-arduino-ide/developer-guide/using-mcs-library/connecting-to-mcslite.md).

# Connecting to MCSLite

Connecting to MCSLite is very simple if you already know how to connect to MCS. The MCS Library provides a class named **MCSLiteDevice**, which can be constructed with

```
MCSLiteDevice(const String& device_id, const String& device_key, const String& server, int port);
```

The parameters **device\_id** and **device\_key** are exactly the same as their **MCSDevice** counterparts. You simply have to provide the server **address** and **port** of your own **MCSLite** server. The rest of your program remains the same. In this tutorial, we'll show you how to modify the previous MCS example, **LED\_control**, to the MCSLite version.

### Getting MCSLite Server IP and Port <a href="#connectingtomcslite-gettingmcsliteserveripandport" id="connectingtomcslite-gettingmcsliteserveripandport"></a>

To setup your own MCSLite server, follow these steps:

1. Download [MCSLite](https://github.com/MCS-Lite/mcs-lite-app/releases) according to your platform.
2. Unzip the downloaded package. It can be under any directory.
3. Execute the **mcs-lite-app executable** in the unzipped directory.

{% hint style="info" %}
Notes for macOS:

Make sure you run the **setup** script before running mcs-lite-app for the first time.\
To run the mcs-lite-app, you need to right-click on the app and choose **open** if you run into the following warning message box:

![](https://3972650740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY4gduUSLWOCI23CXUWej%2Fuploads%2Fyq1Z6QqPk3CSksPsfkz8%2Funknown_warning.png?alt=media\&token=73973acd-bdbf-4d14-aa49-4ca7aef4d8d4)
{% endhint %}

4\. You'll see the **IP** and **Port** information in the launched application. This is the server address.

5.You can know use your browser to connect to the IP and port, e.g.&#x20;

```
http://172.23.6.42:3000/
```

6.Now set up your prototypes, channels and devices just like the [previous MCS example](https://docs.labs.mediatek.com/resource/linkit7697-arduino/en/developer-guide/using-mcs-library/connecting-to-mcs).

For more information on using MCSLite, visit the [MCSLite introduction](http://mcs-lite-introduction.netlify.com/) page.

### Using MCSLiteDevice <a href="#connectingtomcslite-usingmcslitedevice" id="connectingtomcslite-usingmcslitedevice"></a>

Now we need to modify the sketch. In your Arduino IDE, select **File**, then **Examples**, click **MCS** then select **LED\_control**.

Find the line **MCSDevice**, and modify it to **MCSLiteDevice**, as following:

```
// Assign device id/key of your test device
// MCSDevice mcs("your_device_id", "your_device_key");
MCSLiteDevice mcs("your_device_id", "your_device_key", "172.23.6.42", 3000);
```

{% hint style="info" %}
The **IP** and **port** may be different according to your platform, you need to modify it to the same value shown in the **mcs-lite-app** application.
{% endhint %}

Now run the sketch as in the previous MCS example. It should work the same as the MCS version.
