When editing complex programs in Codecraft, it is necessary to frequently test whether the effect of hardware operation meets expectations. At this time, you need to use the online debugging function.

Project Overview

The sound control lights uses 3 Grove Zero modules: Main Board BLE, RGB LED, Sound Sensor, modules and connection methods as shown in the figure below:
image.png
The desired effect is as follows: make a sound (high-five, tap, call…), and the RGB LED can be switched on (continuously red light) and off.

Project steps

1. Write a program with Codecraft

Open Codecraft to start programming, and make sure that the current device is Grove Zero in device mode.
The programmed program is shown in the figure below.
How to use Online debugging example project: Sound controlled lights - 图2

2. Connect the Main Board BLE, sound sensor, and computer

Use a USB data cable to connect the Main Board BLE, to the computer, as shown in the figure below. The light on the Main Board BLE, will light up after connection.
image.png

3. Connect the device and turn on Online Debugging

After the device is connected, enter the Codecraft interface, connect the device and start online debug, as shown in the figure below.
device_online_debug-1.gif
After the online debug is enabled, click on the program, and notice that the gold border around the program means that it is now in the online debug running state.
Now the modified program does not need to be uploaded to the device, just edit and click the building block in the work area to see the effect of running on the hardware. Online debugging mode will help you modify and debug programs more efficiently.
device_online_debug-2.gif
How to use Online debugging example project: Sound controlled lights - 图6 Note

During this process, please make sure that the hardware device remains physically connected to Codecraft.

Project program download

Download the program file here: voice control lights-cdc.zip

Devices that currently support online debug

Not all hardware supported by Codecraft can support online debug. The hardware currently supporting online debug includes:

How to use Online debugging example project: Sound controlled lights - 图7 Grove Zero
image.png GLINT