Remarks

Buzzer
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Audio.Buzzer

Code Example

Buzzer buzzer;

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

    buzzer = new Buzzer(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 buzzer.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //A
        await buzzer.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //C#
        await buzzer.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //E

        await Task.Delay(2500);
    }
}

Sample project(s) available on GitHub

Wiring Example

Buzzer Meadow Pin
GND GND
VCC 3.3V
RX D01
Characteristic Locus
Inheritance object PiezoSpeaker > Buzzer
Implements IToneGenerator IDisposable
Inherited Members PiezoSpeaker.Volume PiezoSpeaker.Port PiezoSpeaker.IsDisposed PiezoSpeaker.PlayTone(Frequency) PiezoSpeaker.PlayTone(Frequency, TimeSpan) PiezoSpeaker.StopTone() PiezoSpeaker.SetVolume(float) PiezoSpeaker.Dispose() PiezoSpeaker.Dispose(bool) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Grove.Audio
Assembly Buzzer.dll

Syntax

public class Buzzer : PiezoSpeaker, IToneGenerator, IDisposable

Constructors

Buzzer(IPin)

Creates a new Buzzer driver

Declaration
public Buzzer(IPin pin)

Parameters

Type Name Description
IPin pin

The pin connected to the buzzer

Remarks

Buzzer
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Audio.Buzzer

Code Example

Buzzer buzzer;

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

    buzzer = new Buzzer(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 buzzer.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //A
        await buzzer.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //C#
        await buzzer.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //E

        await Task.Delay(2500);
    }
}

Sample project(s) available on GitHub

Wiring Example

Buzzer Meadow Pin
GND GND
VCC 3.3V
RX D01

Buzzer(IPwmPort)

Creates a new Buzzer driver

Declaration
public Buzzer(IPwmPort port)

Parameters

Type Name Description
IPwmPort port

The PwmPort used to drive the Buzzer

Remarks

Buzzer
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Audio.Buzzer

Code Example

Buzzer buzzer;

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

    buzzer = new Buzzer(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 buzzer.PlayTone(new Frequency(440, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //A
        await buzzer.PlayTone(new Frequency(554.37f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //C#
        await buzzer.PlayTone(new Frequency(659.25f, Frequency.UnitType.Hertz), TimeSpan.FromMilliseconds(500)); //E

        await Task.Delay(2500);
    }
}

Sample project(s) available on GitHub

Wiring Example

Buzzer Meadow Pin
GND GND
VCC 3.3V
RX D01