Wireless control of speakers

Wireless control of speakers

Description

By using the micro:bit wirelessly to remotely control another micro:bit for the corresponding command execution, the micro:bit Retro Arcade can be used on this basis to wirelessly control the speaker via a joystick.

 

1. Use micro:bit Retro Arcade

This is an example of how the micro:bit Retro Arcade is used.

http://wiki.elecfreaks.com/en/microbit/expansion-board/microbit-retro-arcade/

 

1.1 Add corresponding expansion

Click on 'Advanced' in the code drawer of MakeCode to see more code options.

 

In order to program the micro:bit Retro Arcade wirelessly, we need to add an extension library. Find "Extensions" at the bottom of the code drawer and click on it. This will bring up a dialog box, search for "radio" and click to download the library.

 

Once added successfully, the home page appears as shown below.

 

1.2 Writing programs

1.2.1 Familiarity with the use of modules

http://wiki.elecfreaks.com/en/microbit/expansion-board/microbit-retro-arcade/

 

1.2.2 Start writing the MP3 module code

Write a key that sends the number "1" when the A key is pressed.

 

On top of this, of course, more keys can be added and more values sent.

 

2. Using the MP3 module

2.1. Add corresponding expansion

Click on "Advanced" in the code drawer of MakeCode to see more code options.

 

In order to program the MP3 module, we need to add an extension library. Find "Extensions" at the bottom of the code drawer and click on it. This will bring up a dialog box, search for " https://github.com/elecfreaks/pxt-mp3player " and click on download this library.

Once added successfully, the home page will appear as shown below.

 

2.2 Writing programs

2.2.1 Familiarisation with the use of modules

This is an example of the use of the MP3 module.

http://www.elecfreaks.com/learn-cn/microbitOctopus/sensor/octopus_ef04104.html

 

2.2.2 Start writing the MP3 module code

Let's start the test by playing music using the micro:bit button A.

 

Because the MP3 module is based on specifying the contents of the SD card, it is played back. So pay attention to the physical copy order, the first copy in is 1, you can not modify the file name, can not specify the file name alone; folder name must be two digits, 01 ~ 99, for example: 01; file name must be preceded by 3 digits 001 ~ 999, for example: 002 ~ Hi.MP3, similar to the following image.

 

3. Wireless control of speakers

According to the above mastering micro:bit Retro Arcade and voice recognition module, it is possible to use the micro:bit Retro Arcade as remote sensing to store the music we want to play in advance, and then to recognize the corresponding specific situation through the rocker trigger, allowing a simplistic wireless control of the speaker function.

 

A wide variety of functions can also be implemented according to the instructions we want, as shown below.