Skip to content

Instantly share code, notes, and snippets.

@Resseguie
Created June 10, 2014 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Resseguie/ad155ba7a7c24bd1c719 to your computer and use it in GitHub Desktop.
Save Resseguie/ad155ba7a7c24bd1c719 to your computer and use it in GitHub Desktop.
b5 and c6 sound the same
var five = require("../lib/johnny-five.js"),
board = new five.Board();
board.on("ready", function() {
// Creates a piezo object and defines the pin to be used for the signal
var piezo = new five.Piezo(3);
// Injects the piezo into the repl
board.repl.inject({
piezo: piezo
});
// Plays a song
piezo.play({
// song is composed by an array of pairs of notes and beats
// The first argument is the note (null means "no note")
// The second argument is the length of time (beat) of the note (or non-note)
song: [
["B5", 1],
["C6", 1],
["B5", 1],
["C6", 1],
["B5", 1],
["C6", 1],
["B5", 1],
["C6", 1],
["B5", 1],
["C6", 1]
],
tempo: 200
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment