This page describes how to program xLight with the mobile mBlock 5 app.
Before you start, make sure that you've got:
- A tablet or smart phone
If you haven't assembled your xLight, see Assemble xLight to assemble it and connect it to a power supply.
2. Get or update the mBlock app
Use your mobile device to scan the following QR code to get or update your mBlock 5 app.
Alternatively, search for mBlock in an app store to download or update it.
3. Connect xLight to the mBlock 5 app
(1) Turn on Bluetooth on your smart device.
(2) Tap to open the mBlock 5 app.
(3) Tap Coding, and tap + on the page that appears.
(4) In the sprite library, choose Devices > xLight and tap √.
(5) Tap the xLight setting icon and tap Connect on the Device setting page.
(6) Place the smart device close to xLight.
mBlock 5 automatically searches for and connects to xLight.
After the connection is complete, a voice message is played, indicating that the connection is successful.
4. Program xLight
(1) Tap Back to coding.
(2) Set the coding mode.
mBlock 5 provides two coding modes, namely Upload and Live.
Live: In this mode, you can execute the program you've written in real time. During program execution, you must keep xLight connected to mBlock 5.
Upload: In this mode, you need to upload the program to xLight before you execute it. You don't have to keep xLight connected to mBlock 5 during program execution.
For example, set the coding mode to Upload.
(3) Drag blocks to the scripts area.
For example, we can write a simple program to light up the LEDs of xLight assembled with the wooden base and keep changing the brightness of the LEDs.
If you program xLight assembled with the LED strip or LED string, use the blocks in the LED Strip or LED String category.
(4) Click the Upload icon to upload the program to xLight.
After you upload the program to xLight, xLight lights up the LEDs in red and the brightness keeps changing.
Note: The control box of xLight can store only one user-defined program. A new program you upload to it replaces the last one.
5. Switch between the user-defined program and default program
You can switch between the default program and user-defined one by continuously pressing the button three times.
For details about the default program, see Default Program of xLight.