1.0.0 • Published 6 years ago

morse2piezo v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

morse2piezo

converts morse code notation to a piezo song for use with Johnny Five's Piezo class.

Usage

I recommend you use the morse package to convert your text into morse code notation first.

const morse2piezo = require('morse2piezo');
const morse = require('morse');
const five = require('johnny-five');

const sequence = morse.encode('hello world');
// first argument is the note / tone, second is the morse sequence.
const song = morse2piezo('B1', sequence);

five.Board().on('ready', () => {
  const piezo = new five.Piezo(9);
  piezo.play({song, tempo: 500});
});