From 48a1f8fab14471715454f0471e76fba77263b42f Mon Sep 17 00:00:00 2001 From: Elizar Date: Mon, 13 Feb 2017 15:39:55 +0300 Subject: [PATCH 1/2] Addeded library crastandrum.js --- modules/@amperka/crastandrum.js | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 modules/@amperka/crastandrum.js diff --git a/modules/@amperka/crastandrum.js b/modules/@amperka/crastandrum.js new file mode 100644 index 0000000..eecf1e4 --- /dev/null +++ b/modules/@amperka/crastandrum.js @@ -0,0 +1,70 @@ +//Library for use Drum with Piezo element and MIDI signals. +//Wiki at https://gitlab.com/espruinolibs/MidiLibs/wikis/home + +function min(a,b) +{ + if(aobj.limit) + { + obj.max = 0; + while(a>obj.max) + { + obj.max=a; + a = analogRead(obj.pin); + } + Output1(obj.channel,obj.note,obj.max,obj.serial,obj.size_const); + obj.bit=true; + } + else; + else if(obj.bit) + if(a===0.0) + { + obj.delay = true; + setTimeout(function () {obj.bit = false;obj.delay = false;}, obj._delay); + Output2(obj.channel,obj.note,obj.serial); + } + } + },this.interval,this.obj); +} + +exports.connect = function(pin, interval, delay, limit, serial, channel, note, size_const) { + return new Drum(pin, interval, delay, limit, serial, channel, note, size_const); +}; + From 42aced24b231b5a4dac288e4c45e1a7abc0f5d11 Mon Sep 17 00:00:00 2001 From: Elizar Date: Wed, 29 Mar 2017 03:10:52 +0300 Subject: [PATCH 2/2] Fexed bug this output_type --- modules/@amperka/crastandrum.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/@amperka/crastandrum.js b/modules/@amperka/crastandrum.js index eecf1e4..19efee9 100644 --- a/modules/@amperka/crastandrum.js +++ b/modules/@amperka/crastandrum.js @@ -34,7 +34,6 @@ var Drum = function(pin, interval, delay, limit, serial, channel, note, size_con this.delay = false; this.note=note; this.serial=serial; - this.output_type=output_type; this.channel=channel; this.obj={pin:this._pin,limit:this.limit,delay:this.delay,Time:this.Time,bit:this.bit,_delay:this._delay,note:this.note,serial:this.serial,channel:this.channel,size_const:this.size_const} setInterval(function(obj) {