Skip to main content

Meadow.Foundation.Audio.Mp3.Yx5300

Yx5300
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Audio.Mp3.Yx5300

Code Example

Yx5300 mp3Player;

public override Task Initialize()
{
Resolver.Log.Info("Initialize...");

mp3Player = new Yx5300(Device, Device.PlatformOS.GetSerialPortName("COM4"));

return Task.CompletedTask;
}

public override async Task Run()
{
mp3Player.SetVolume(15);

var status = await mp3Player.GetStatus();
Resolver.Log.Info($"Status: {status}");

var count = await mp3Player.GetNumberOfTracksInFolder(0);
Resolver.Log.Info($"Number of tracks: {count}");

mp3Player.Play();

await Task.Delay(5000); //leave playing for 5 seconds

mp3Player.Next();

await Task.Delay(5000); //leave playing for 5 seconds
}

Sample project(s) available on GitHub

Wiring Example

To wire a Yx5300 to your Meadow board, connect the following:

Yx5300Meadow Pin
GNDGND
VCC3.3V
RXD01
TXD00

Wiring a Yx5300 to a Meadow F7

Class Yx5300

Represents a Yx5300 serial MP3 player

Assembly: Yx5300.dll
View Source
Declaration
public class Yx5300 : IDisposable

Implements:
System.IDisposable

Properties

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Methods

Reset()

Reset the YX5300 hardware

View Source
Declaration
public void Reset()

Sleep()

Set the power state to sleep

View Source
Declaration
public void Sleep()

WakeUp()

Set the power state to normal operations

View Source
Declaration
public void WakeUp()

SetVolume(byte)

Set volume of YX5300

View Source
Declaration
public void SetVolume(byte volume)
Parameters
TypeNameDescription
System.Bytevolumebyte value from 0-30

VolumeUp()

Increase audio volume by 1 (0-30)

View Source
Declaration
public void VolumeUp()

VolumeDown()

Decrease audio volume by 1 (0-30)

View Source
Declaration
public void VolumeDown()

GetVolume()

Get audio volume (0-30)

View Source
Declaration
public Task<byte> GetVolume()
Returns

System.Threading.Tasks.Task<System.Byte>

GetIndexOfCurrentFile()

Get index of currently playing file

View Source
Declaration
public Task<byte> GetIndexOfCurrentFile()
Returns

System.Threading.Tasks.Task<System.Byte>

GetNumberOfFolders()

Get number of folders

View Source
Declaration
public Task<byte> GetNumberOfFolders()
Returns

System.Threading.Tasks.Task<System.Byte>

GetNumberOfTracksInFolder(byte)

Get count of mp3 files in folder

View Source
Declaration
public Task<byte> GetNumberOfTracksInFolder(byte folderIndex)
Returns

System.Threading.Tasks.Task<System.Byte>

Parameters
TypeNameDescription
System.BytefolderIndexindex of folder

GetStatus()

Get status of YX5300

View Source
Declaration
public Task<Yx5300.PlayStatus> GetStatus()
Returns

System.Threading.Tasks.Task<Meadow.Foundation.Audio.Mp3.Yx5300.PlayStatus>: PlayStatus enum### Play() Play current file

View Source
Declaration
public void Play()

Play(byte)

Play song at index

View Source
Declaration
public void Play(byte songIndex)
Parameters
TypeNameDescription
System.BytesongIndexindex of mp3 file in folder

Next()

Advance to next track

View Source
Declaration
public void Next()

Previous()

Move back to previous track

View Source
Declaration
public void Previous()

Pause()

Pause current mp3

View Source
Declaration
public void Pause()

Stop()

Stop current mp3

View Source
Declaration
public void Stop()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • System.IDisposable