Speaker speaker;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
speaker = new Speaker(Device.Pins.D13);
return Task.CompletedTask;
}
public override async Task Run()
{
for (int i = 0; i < 5; i++)
{
Resolver.Log.Info("Playing A major triad starting at A4");
await speaker.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500));
await speaker.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500));
await speaker.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500));
await Task.Delay(2500);
}
}