Welcome to BRICKS.
This tutorial covers the second step in working with Generators: peripheral function control. By completing this chapter, you will easily master the fundamental use of Generators in the BRICKS Cloud Intelligent Display.
π Estimated time to complete this tutorial: 5β8 minutes
Step 1: Create a New Media Box
In this lesson, we will insert two audio files related to the countdown and use events to trigger playback through Generators. First, create a new Media Box to store the audio files. From the APPLICATION page, click [ β ] at the top-left to return, then select the [ MEDIA ] tab. Next, click [ New Box ] at the bottom-left corner to create a new Media Box.
Name the new Media Box SoundBox, and click [ New Box ] again to confirm.
Step 2: Upload Two Audio Files
Search online for a ticking sound for the countdown and a bell sound for when the countdown ends. After creating the SoundBox Media Box, select [ Upload ] to add the audio files.
Choose the files from your device and upload them into the Media Box.
Step 3: Create Two Sound Playback Generators
Generators also support audio playback. Create two new Generators, and in the Template field, select [ SoundPlayer ] to enable audio playback.
For each Generator, go to the property panel on the left, locate the File Path field, and click the [ π§ ] icon to open the Media Box.
Select the SoundBox you created earlier and assign the corresponding audio files. Make sure both SoundPlayer Generators are set up with the correct audio files.
Step 4: Create Events to Trigger Sound Playback
Find the countdown text element created in the previous lesson. In the property panel on the right, locate the event settings and select Before Value Change and On Press to trigger the countdown ticking sound and the countdown completion sound, respectively. The Before Value Change event is triggered when the text content changes. Since the countdown Generator updates the text Brick through a variable, the text automatically changes according to the countdown and fires the event.
Use this event to trigger the ticking sound.
For the On Press event, configure it to play the other audio file for the countdown completion sound.
Step 5: Preview on Device
Save the application and preview it on a device. Check whether the ticking sound plays correctly during the countdown and whether tapping the text correctly triggers the completion sound. Donβt forget to turn on the device volume.
Congratulations! You have now learned the basic concepts of peripheral function control.
The next lesson will introduce the Event Flow Controller.
For any assistance, please click the chat icon in the bottom-right corner. Our team will respond to your questions as quickly as possible.