npm.io
1.0.0 • Published 8 years ago

morse2piezo

Licence
MIT
Version
1.0.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
9

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});
});