scop

Library for the scopitone workshop

scop

Library for the scopitone workshop

  • install with npm install scop --save
  • check the demo sample:
var Scop = require('scop'),
    // new instance of the arduino controler 
    scop = new Scop('/dev/ttyACM0');
 
// bpm and sequence to be played 
var bpm = 180;
var seq = [1,1,1,2,3,0,2,0,1,3,2,2,1];
 
// only start playing when the serial port is open 
scop.on('ready', function() {
    // play the sequence at the defined bpm 
    scop.play(seq, bpm);
    // loop the sequence after a 1s pause 
    scop.on('played', function() {
        setTimeout(function() {
            scop.play(seq, bpm);
        }, 1000);
    });
});

A class that instanciate a serial port communication with the arduino. When the serial port is opened, it sends a 'ready' event.

Play sequentially the motors. The sequence provided is an array of motorID (i.e from 1 to 4). If you put a 0 on the array it means no motor will be played during the measure. When the sequence is finished, an event is sent.