MakeCode extension for Serial MP3 players with the YX5300 chip.
Da der Build nicht klappt, hier der Link zum fertigen Makecodeprojekt https://makecode.com/_TdC33daF9XdC
The MakerBit connects to the Calliope Mini to provide easy connections to a wide variety of sensors, actuators and other components, for example a Serial MP3 player.
MakerBit | MakerBit+R with motor controller |
This extension supports MP3 devices with the YX5300 chip, e.g. the Catalex Serial MP3.
The microSD card shall be formatted as FAT16 or FAT32. exFAT is not supported properly and shall be avoided.
To support all commands properly, the names of folders and files need to obey the following strict pattern:
- Directory names are two-digit numbers, e.g.
01
. - Track names within the directories shall start with a three digit numbers such as
001.mp3
or002.wav
Up to 99 directories and 255 tracks per directory are supported.
├── 01/
│ ├── 001.mp3
│ ├── 002 second track.mp3
│ └── 003 third track.mp3
├── 02/
│ ├── 001.mp3
│ └── 002.mp3
│
…
The MP3 device reads files and folders in alphabetic order. It is required to create a sequence of folders like 01
, 02
, 03
and name the tracks within each folder starting at 001
. Make sure to avoid gaps in your number based naming scheme. This allows you to use folder and track names as parameters in the playback functions below.
If you experience playback problems, check for deviations to the naming convention and the file system format.
Connects to serial MP3 device with chip YX5300. The first pin needs to be attached the MP3 device receiver pin (RX) and the second pin to the MP3 device transmitter pin (TX).
makerbit.connectSerialMp3(DigitalPin.P0, DigitalPin.P1)
Plays a track from a folder.
makerbit.playMp3TrackFromFolder(1, 1, Mp3Repeat.No)
Plays all tracks in a folder.
makerbit.playMp3Folder(1, Mp3Repeat.No)
Sets the volume.
makerbit.setMp3Volume(30)
Dispatches a command to the MP3 device.
makerbit.runMp3Command(Mp3Command.PLAY_NEXT_TRACK)
Do something when a MP3 track is started.
makerbit.onMp3TrackStarted(() => {})
Do something when a MP3 track is completed.
makerbit.onMp3TrackCompleted(() => {})
Returns the index of the selected MP3 folder.
makerbit.mp3Folder()
Returns the index of the last MP3 track event.
makerbit.mp3Track()
Returns the MP3 volume.
makerbit.mp3Volume()
Licensed under the MIT License (MIT). See LICENSE file for more details.
- for PXT/calliope