· Chris Hammond
Last Updated

How to use the Netduino Go Piezo Buzzer Module

Get started with Netduino Go Piezo Buzzer Modules! Unlock fun projects and learn to generate tunes with preset codes. Discover more on Netduino projects.

Get started with Netduino Go Piezo Buzzer Modules! Unlock fun projects and learn to generate tunes with preset codes. Discover more on Netduino projects.

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.

Back to Blog

Related Posts

View All Posts »
Learning about C Bitshift Operators

Learning about C Bitshift Operators

Learn about bitwise operations in C programming, such as AND and OR using Binary. Discover the power of BitShift and how it enhances your coding skills.

Netduino powered tracked vehicle, Part 1

Netduino powered tracked vehicle, Part 1

Discover how I got my Tamiya Tracked Vehicle Chassis Kit working with Netduino! Learn about wiring, code tweaks, and future gear upgrades. Stay tuned for more Netduino adventures!