How to use the Netduino Go Piezo Buzzer Module

Over the next couple of days people should be receiving their Netduino Go Piezo Buzzer Modules, at least if they have ordered them from Amazon.

I was lucky enough to get mine very quickly from Amazon and put together a sample project the other night. This is by no means a complex project, and most of it is code from the public domain for projects based on the original Netduino.

Project Overview

So what does the project do? Essentially it plays 3 “tunes” that are predefined in the code. The tunes and most of the code for the project are based on this thread on Netduino.com.

The primary method for interacting with a Piezo Buzzer module is pretty simple, you just need the following three lines.

PiezoBuzzer Pb1 = new PiezoBuzzer(GoSockets.Socket1);
Pb1.SetFrequency(####);
Thread.Sleep(####);

Socket1 would be the location where you have the module plugged in to the Netduino Go. The ### for SetFrequency is a float, 440.00 should be an A where the note C would be 261.63.Duration is an integer in milliseconds, so 1000 would be 1 second. Basically once you set the frequency you tell the program to sleep for 1 second to let the note play out.

The code in the project is a little more complex than that, providing octaves of notes and their frequencies, as well as the ability to pass in an array of notes and tempo to adjust for speed/duration.

Download the code

But enough of that, how about a video of it in action?

Other Netduino Go Projects

Be sure to check out some of my other Netduino projects and blog posts.

Recent Comments

There are currently no comments. Be the first to make a comment.

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type Human2 in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond

is a father, husband, leader, developer, photographer and car guy. Chris has long specialized in ASP.NET and DotNetNuke (DNN) development, so you will find a variety of posts relating to those topics. For more information check out the about Chris Hammond page.

If you are looking for DotNetNuke consulting please visit Christoc.com Software Solutions

Find me on Twitter, GitHub and LinkedIn.