Remarks

Yx5300
Status
Source code GitHub
NuGet package

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Yx5300 mp3Player;

    RgbPwmLed onboardLed;

    public MeadowApp()
    {
        Initialize();

        onboardLed.SetColor(Color.Yellow);

        Mp3Test();
    }

    async Task Mp3Test()
    {
        onboardLed.SetColor(Color.Green);

        mp3Player.SetVolume(15);

        var status = await mp3Player.GetStatus();
        Console.WriteLine($"Status: {status}");

        var count = await mp3Player.GetNumberOfTracksInFolder(0);
        Console.WriteLine($"Count: {count}");

        mp3Player.Play();
        await Task.Delay(5000);

        status = await mp3Player.GetStatus();
        Console.WriteLine($"Status: {status}");

        mp3Player.Next();

        onboardLed.SetColor(Color.Blue);
    }

    void Initialize()
    {
        Console.WriteLine("Initialize hardware...");

        onboardLed = new RgbPwmLed(device: Device,
            redPwmPin: Device.Pins.OnboardLedRed,
            greenPwmPin: Device.Pins.OnboardLedGreen,
            bluePwmPin: Device.Pins.OnboardLedBlue,
            3.3f, 3.3f, 3.3f,
            Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode);

        mp3Player = new Yx5300(Device, Device.SerialPortNames.Com4);
    }
}

Sample projects available on GitHub

Wiring Example

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

Yx5300 Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00
Characteristic Locus
Inheritance System.Object > Yx5300
Inherited Members System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace Meadow.Foundation.Audio.Mp3
Assembly Yx5300.dll

Syntax

public class Yx5300

Constructors

Yx5300(IIODevice, SerialPortName)

Declaration
public Yx5300(IIODevice device, SerialPortName serialPortName)

Parameters

Type Name Description
IIODevice device
SerialPortName serialPortName

Yx5300(ISerialPort)

Declaration
protected Yx5300(ISerialPort serialPort)

Parameters

Type Name Description
ISerialPort serialPort

Methods

GetIndexOfCurrentFile()

Declaration
public Task<byte> GetIndexOfCurrentFile()

Returns

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

GetNumberOfFolders()

Declaration
public Task<byte> GetNumberOfFolders()

Returns

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

GetNumberOfTracksInFolder(Byte)

Declaration
public Task<byte> GetNumberOfTracksInFolder(byte folderIndex)

Parameters

Type Name Description
System.Byte folderIndex

Returns

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

GetStatus()

Declaration
public Task<Yx5300.PlayStatus> GetStatus()

Returns

Type Description
System.Threading.Tasks.Task<Yx5300.PlayStatus>

GetVolume()

Declaration
public Task<byte> GetVolume()

Returns

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

Next()

Declaration
public void Next()

Pause()

Declaration
public void Pause()

Play()

Declaration
public void Play()

Play(Byte)

Declaration
public void Play(byte songIndex)

Parameters

Type Name Description
System.Byte songIndex

Previous()

Declaration
public void Previous()

Reset()

Declaration
public void Reset()

SetVolume(Byte)

Declaration
public void SetVolume(byte volume)

Parameters

Type Name Description
System.Byte volume

Sleep()

Declaration
public void Sleep()

Stop()

Declaration
public void Stop()

VolumeDown()

Declaration
public void VolumeDown()

VolumeUp()

Declaration
public void VolumeUp()

WakeUp()

Declaration
public void WakeUp()