Connecting to MCSLite
Last updated
Last updated
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
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.
To setup your own MCSLite server, follow these steps:
Download MCSLite according to your platform.
Unzip the downloaded package. It can be under any directory.
Execute the mcs-lite-app executable in the unzipped directory.
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:
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.
6.Now set up your prototypes, channels and devices just like the previous MCS example.
For more information on using MCSLite, visit the MCSLite introduction page.
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:
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.
Now run the sketch as in the previous MCS example. It should work the same as the MCS version.