diff --git a/README.md b/README.md index b045f94..7e67c97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HelloDrum Arduino Library This is a library for making E-Drum with Arduino. -**Ver.0.7.4(4/27/2020) Work in progress.** +**Ver.0.7.5(4/30/2020) Work in progress.** ## Description @@ -190,11 +190,11 @@ Record the time you started closing the hi-hat and the time you finished closing ## Velocity Curve - - Velocity Curve Type (Ver 0.7.4) + - Velocity Curve Type (Ver 0.7.5) -## Circuit (v0.7.4) +## Circuit (v0.7.5) - Single Piezo @@ -234,6 +234,12 @@ The STL data of pads from 6 inches to 12 inches, hi-hat controllers( MIDI_CREATE_DEFAULT_INSTANCE(); -//Please name your piezo. -//The piezo named "crash" is connected to the A0 pin and A1 pin. +//Please name your cymbal. +//The cymbal named "crash" is connected to the A0 pin (piezo) and A1 pin (edge sensor). HelloDrum crash(0, 1); void setup() diff --git a/examples/Basic/cymbal_3zone/cymbal_3zone.ino b/examples/Basic/cymbal_3zone/cymbal_3zone.ino index 468416e..2683b7a 100644 --- a/examples/Basic/cymbal_3zone/cymbal_3zone.ino +++ b/examples/Basic/cymbal_3zone/cymbal_3zone.ino @@ -1,7 +1,7 @@ /* EXAMPLE - 3 Zone Cymbal Sensing - This sample code tesed with YAMAHA PCY135/PCY155. + This sample code is tesed with YAMAHA PCY135/PCY155. https://open-e-drums.tumblr.com/ */ @@ -36,8 +36,8 @@ byte RIDE[10] = { #include MIDI_CREATE_DEFAULT_INSTANCE(); -//Please name your piezo. -//The piezo named ride is connected to the A0 pin and A1 pin. +//Please name your cymbal. +//The cymbal named ride is connected to the A0 pin (piezo) and A1 pin (edge sensor). HelloDrum ride(0, 1); void setup() diff --git a/examples/Basic/dualPiezoSensing/dualPiezoSensing.ino b/examples/Basic/dualPiezoSensing/dualPiezoSensing.ino index 6c7da4d..812cab5 100644 --- a/examples/Basic/dualPiezoSensing/dualPiezoSensing.ino +++ b/examples/Basic/dualPiezoSensing/dualPiezoSensing.ino @@ -1,7 +1,7 @@ /* EXAMPLE - Dual Piezo Sensing - With this sample code, you can make 2 zone snare drum. + With this sample code, you can make 2-zone snare drum. Tested with Roland PD-85 Pads & Controller Circuit: @@ -61,7 +61,6 @@ void setup() void loop() { - //Sensing pad. snare.dualPiezo(SNARE[0], SNARE[1], SNARE[2], SNARE[3], SNARE[4], SNARE[5]); //dualPiezo(byte sens, byte thre, byte scan, byte mask, byte rimSens, byte rimThre); diff --git a/examples/Basic/hihat/hihat.ino b/examples/Basic/hihat/hihat.ino index 1db8fbc..f4856a3 100644 --- a/examples/Basic/hihat/hihat.ino +++ b/examples/Basic/hihat/hihat.ino @@ -76,7 +76,7 @@ void loop() MIDI.sendNoteOff(HIHAT[4], 0, 10); } //2.close - else + else if (hihatPedal.closeHH == true) { MIDI.sendNoteOn(HIHAT[5], hihat.velocity, 10); //(note, velocity, channel) MIDI.sendNoteOff(HIHAT[5], 0, 10); @@ -84,7 +84,7 @@ void loop() } //when pedal is closed - if (hihatPedal.closeHH == true) + if (hihatPedal.hit == true) { MIDI.sendNoteOn(HIHAT_PEDAL[5], hihatPedal.velocity, 10); //(note, velocity, channel) MIDI.sendNoteOff(HIHAT_PEDAL[5], 0, 10); diff --git a/examples/Basic/hihat_2zone/hihat_2zone.ino b/examples/Basic/hihat_2zone/hihat_2zone.ino index 644dfdc..74f55fa 100644 --- a/examples/Basic/hihat_2zone/hihat_2zone.ino +++ b/examples/Basic/hihat_2zone/hihat_2zone.ino @@ -1,14 +1,14 @@ /* - EXAMPLE - 2-zone Hi-Hat with hihat Controller (FSR or TCRT5000) + EXAMPLE - 2-zone Hi-Hat with hihat Controller (FSR or TCRT5000) - This sample code tesed with Roland VH-10. - https://open-e-drums.tumblr.com/ + This sample code tesed with Roland VH-10. + https://open-e-drums.tumblr.com/ */ /* NOTICE - You have to install the MIDI library. - MIDI : https://playground.arduino.cc/Main/MIDILibrary + You have to install the MIDI library. + MIDI : https://playground.arduino.cc/Main/MIDILibrary */ @@ -87,7 +87,7 @@ void loop() MIDI.sendNoteOff(HIHAT[5], 0, 10); } //2.close - else + else if (hihatPedal.closeHH == true) { MIDI.sendNoteOn(HIHAT[6], hihat.velocity, 10); //(note, velocity, channel) MIDI.sendNoteOff(HIHAT[6], 0, 10); @@ -105,7 +105,7 @@ void loop() MIDI.sendNoteOff(HIHAT[7], 0, 10); } //2.close - else + else if (hihatPedal.closeHH == true) { MIDI.sendNoteOn(HIHAT[8], hihat.velocity, 10); //(note, velocity, channel) MIDI.sendNoteOff(HIHAT[8], 0, 10); @@ -113,7 +113,7 @@ void loop() } //when pedal is closed - if (hihatPedal.closeHH == true) + if (hihatPedal.hit == true) { MIDI.sendNoteOn(HIHAT_PEDAL[5], hihatPedal.velocity, 10); //(note, velocity, channel) MIDI.sendNoteOff(HIHAT_PEDAL[5], 0, 10); diff --git a/examples/EEPROM/SimpleSensing/SimpleSensing.ino b/examples/EEPROM/SimpleSensing/SimpleSensing.ino index 3565ee8..06f46f8 100644 --- a/examples/EEPROM/SimpleSensing/SimpleSensing.ino +++ b/examples/EEPROM/SimpleSensing/SimpleSensing.ino @@ -1,5 +1,5 @@ /* - EXAMPLE - Simple Piezo Sensing + EXAMPLE - Simple Piezo Sensing (EEPROM and LCD) With this sample code, you will make snare and tom using two piezo. https://open-e-drums.tumblr.com/ diff --git a/examples/EEPROM/minimalDrumkit/minimalDrumkit.ino b/examples/EEPROM/minimalDrumkit/minimalDrumkit.ino index 81d4bbb..b6da4de 100644 --- a/examples/EEPROM/minimalDrumkit/minimalDrumkit.ino +++ b/examples/EEPROM/minimalDrumkit/minimalDrumkit.ino @@ -18,13 +18,12 @@ Button for BACK to digital pin 10 LCD Circuit:https://www.arduino.cc/en/Tutorial/HelloWorld - LCD RS pin to digital pin 12 - LCD Enable pin to digital pin 11 - LCD D4 pin to digital pin 5 - LCD D5 pin to digital pin 4 - LCD D6 pin to digital pin 3 - LCD D7 pin to digital pin 2 - + LCD RS pin to digital pin 12 + LCD Enable pin to digital pin 11 + LCD D4 pin to digital pin 5 + LCD D5 pin to digital pin 4 + LCD D6 pin to digital pin 3 + LCD D7 pin to digital pin 2 https://open-e-drums.tumblr.com/ */ @@ -158,6 +157,23 @@ void loop() lcd.print(hitPad); lcd.setCursor(0, 1); lcd.print(velocity); + + if (hihat.hit == true) + { + //check open or close + //1.open + if (hihatPedal.openHH == true) + { + lcd.setCursor(15, 0); + lcd.print("O"); + } + //2.close + else if (hihatPedal.closeHH == true) + { + lcd.setCursor(15, 0); + lcd.print("C"); + } + } } ////////// 2. SENSING & SENDING MIDI//////////// @@ -195,7 +211,7 @@ void loop() MIDI.sendNoteOff(hihat.noteOpen, 0, 10); } //2.close - else + else if (hihatPedal.closeHH == true) { MIDI.sendNoteOn(hihat.noteClose, hihat.velocity, 10); //(note of close, velocity, channel) MIDI.sendNoteOff(hihat.noteClose, 0, 10); @@ -204,7 +220,7 @@ void loop() //HIHAT CONTROLLER// //when hihat is closed - if (hihatPedal.closeHH == true) + if (hihatPedal.hit == true) { MIDI.sendNoteOn(hihatPedal.note, hihatPedal.velocity, 10); //(note of pedal, velocity, channel) MIDI.sendNoteOff(hihatPedal.note, 0, 10); diff --git a/examples/MUX/muxSensing_minimalDrumKit/muxSensing_minimalDrumkit.ino b/examples/MUX/muxSensing_minimalDrumKit/muxSensing_minimalDrumkit.ino index c02c71a..5a603a4 100644 --- a/examples/MUX/muxSensing_minimalDrumKit/muxSensing_minimalDrumkit.ino +++ b/examples/MUX/muxSensing_minimalDrumKit/muxSensing_minimalDrumkit.ino @@ -207,7 +207,7 @@ void loop() MIDI.sendNoteOff(hihat.noteOpen, 0, 10); } //2.close - else + else if (hihatPedal.closeHH == true) { MIDI.sendNoteOn(hihat.noteClose, hihat.velocity, 10); //(note of close, velocity, channel) MIDI.sendNoteOff(hihat.noteClose, 0, 10); @@ -216,7 +216,7 @@ void loop() //HIHAT CONTROLLER// //when hihat is closed - if (hihatPedal.closeHH == true) + if (hihatPedal.hit == true) { MIDI.sendNoteOn(hihatPedal.note, hihatPedal.velocity, 10); //(note of pedal, velocity, channel) MIDI.sendNoteOff(hihatPedal.note, 0, 10); diff --git a/library.properties b/library.properties index c165071..59b0303 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Hello Drum -version=0.7.4 +version=0.7.5 author=Ryo Kosaka maintainer=Ryo Kosaka sentence=Arduino Library for piezo sensing diff --git a/src/hellodrum.cpp b/src/hellodrum.cpp index aa1a83c..b295c38 100644 --- a/src/hellodrum.cpp +++ b/src/hellodrum.cpp @@ -1,13 +1,14 @@ /* - "HELLO DRUM LIBRARY" Ver.0.7.4 + "HELLO DRUM LIBRARY" Ver.0.7.5 - by Ryo Kosaka, Claudio Cas + by Ryo Kosaka GitHub : https://github.com/RyoKosaka/HelloDrum-arduino-Library Blog : https://open-e-drums.tumblr.com/ */ -//#define DEBUG_DRUM //<-- uncomment this line to have debug value on Serial +//#define DEBUG_DRUM //<-- uncomment this line to enable debug mode with Serial. +//#define PULLUP //<-- uncomment this line to enable pullup mode. #include "hellodrum.h" #include "Arduino.h" @@ -23,6 +24,10 @@ HelloDrum::HelloDrum(byte pin1) { pin_1 = pin1; +#ifdef PULLUP + pinMode(pin_1, INPUT_PULLUP); +#endif + //initial EEPROM value sensitivity = 100; //0 threshold1 = 10; //1 @@ -46,6 +51,11 @@ HelloDrum::HelloDrum(byte pin1, byte pin2) pin_1 = pin1; pin_2 = pin2; +#ifdef PULLUP + pinMode(pin_1, INPUT_PULLUP); + pinMode(pin_2, INPUT_PULLUP); +#endif + //initial value sensitivity = 100; //0 threshold1 = 10; //1 @@ -131,14 +141,16 @@ HelloDrumKnob::HelloDrumKnob(byte pin1) void HelloDrum::singlePiezoSensing(byte sens, byte thre, byte scanTime, byte maskTime) { - #ifdef ESP32 - int Threshold = thre * 40; - int Sensitivity = sens * 40; -#else + piezoValue = piezoValue / 4; +#endif + +#ifdef PULLUP + piezoValue = (1024 - piezoValue); +#endif + int Threshold = thre * 10; int Sensitivity = sens * 10; -#endif hit = false; @@ -189,13 +201,13 @@ void HelloDrum::singlePiezoSensing(byte sens, byte thre, byte scanTime, byte mas padIndex = padNum; #ifdef DEBUG_DRUM - Serial.print("Hit : "); + Serial.print("[Hit] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif @@ -208,16 +220,19 @@ void HelloDrum::dualPiezoSensing(byte sens, byte thre, byte scanTime, byte maskT { #ifdef ESP32 - int Threshold = thre * 40; - int Sensitivity = sens * 40; - int RimThreshold = rimThre * 40; - int RimSensitivity = rimSens * 40; -#else + piezoValue = piezoValue / 4; + RimPiezoValue = RimPiezoValue / 4; +#endif + +#ifdef PULLUP + piezoValue = (1024 - piezoValue); + RimPiezoValue = (1024 - RimPiezoValue); +#endif + int Threshold = thre * 10; int Sensitivity = sens * 10; int RimThreshold = rimThre * 10; int RimSensitivity = rimSens * 10; -#endif hit = false; hitRim = false; @@ -270,24 +285,20 @@ void HelloDrum::dualPiezoSensing(byte sens, byte thre, byte scanTime, byte maskT velocityRim = curve(velocityRim, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("HitRim : "); + Serial.print("[HitRim] velocity : "); Serial.print(velocity); - Serial.print(", "); + Serial.print(", velocity rim : "); Serial.print(velocityRim); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); Serial.print(", "); Serial.print(prevVelR); - Serial.print(", "); + Serial.print(", head - rim : "); Serial.print(prevVel - prevVelR); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); - Serial.print((time_end - time_hit)); - Serial.print(", "); - Serial.print(RimSensitivity); - Serial.print(", "); - Serial.println(RimThreshold); + Serial.print(", ScanTime(ms) : "); + Serial.println((time_end - time_hit)); #endif velocity = velocityRim; hitRim = true; @@ -300,24 +311,20 @@ void HelloDrum::dualPiezoSensing(byte sens, byte thre, byte scanTime, byte maskT velocityRim = curve(velocityRim, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit : "); + Serial.print("[Hit Head] velocity : "); Serial.print(velocity); - Serial.print(", "); + Serial.print(", velocity rim : "); Serial.print(velocityRim); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); Serial.print(", "); Serial.print(prevVelR); - Serial.print(", "); + Serial.print(", d : "); Serial.print(prevVel - prevVelR); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); - Serial.print((time_end - time_hit)); - Serial.print(", "); - Serial.print(RimSensitivity); - Serial.print(", "); - Serial.println(RimThreshold); + Serial.print(", ScanTime(ms) : "); + Serial.println((time_end - time_hit)); #endif hit = true; } @@ -337,14 +344,18 @@ void HelloDrum::cymbal2zoneSensing(byte sens, byte thre, byte scanTime, byte mas { #ifdef ESP32 - int Threshold = thre * 40; - int Sensitivity = sens * 40; - int edgeThreshold = edgeThre * 40; -#else + piezoValue = piezoValue / 4; + sensorValue = sensorValue / 4; +#endif + +#ifdef PULLUP + piezoValue = (1024 - piezoValue); + sensorValue = (1024 - sensorValue); +#endif + int Threshold = thre * 10; int Sensitivity = sens * 10; int edgeThreshold = edgeThre * 10; -#endif hit = false; hitRim = false; @@ -398,17 +409,17 @@ void HelloDrum::cymbal2zoneSensing(byte sens, byte thre, byte scanTime, byte mas velocity = curve(velocity, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit Bow : "); + Serial.print("[Hit Bow] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print(", "); + Serial.print(", firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif @@ -424,17 +435,17 @@ void HelloDrum::cymbal2zoneSensing(byte sens, byte thre, byte scanTime, byte mas velocity = curve(velocity, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit Edge : "); + Serial.print("[Hit Edge] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print(", "); + Serial.print(", firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif @@ -449,17 +460,13 @@ void HelloDrum::cymbal2zoneSensing(byte sens, byte thre, byte scanTime, byte mas { #ifdef DEBUG_DRUM - Serial.print("Choke : "); - Serial.print(velocity); - Serial.print(" (raw:"); - Serial.print(prevVel); - Serial.print(", "); + Serial.print("[Choke] firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif @@ -473,17 +480,21 @@ void HelloDrum::cymbal2zoneSensing(byte sens, byte thre, byte scanTime, byte mas void HelloDrum::cymbal3zoneSensing(byte sens, byte thre, byte scanTime, byte maskTime, byte edgeThre, byte cupThre) { + #ifdef ESP32 - int Threshold = thre * 40; - int Sensitivity = sens * 40; - int edgeThreshold = edgeThre * 40; - int cupThreshold = cupThre * 40; -#else + piezoValue = piezoValue / 4; + sensorValue = sensorValue / 4; +#endif + +#ifdef PULLUP + piezoValue = (1024 - piezoValue); + sensorValue = (1024 - sensorValue); +#endif + int Threshold = thre * 10; int Sensitivity = sens * 10; int edgeThreshold = edgeThre * 10; int cupThreshold = cupThre * 10; -#endif hit = false; hitRim = false; @@ -538,17 +549,17 @@ void HelloDrum::cymbal3zoneSensing(byte sens, byte thre, byte scanTime, byte mas { velocity = curve(velocity, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit Bow : "); + Serial.print("[Hit Bow] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print(", "); + Serial.print(", firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif hit = true; @@ -562,17 +573,17 @@ void HelloDrum::cymbal3zoneSensing(byte sens, byte thre, byte scanTime, byte mas { velocity = curve(velocity, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit Edge : "); + Serial.print("[Hit Edge] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print(", "); + Serial.print(", firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif hitRim = true; @@ -586,17 +597,17 @@ void HelloDrum::cymbal3zoneSensing(byte sens, byte thre, byte scanTime, byte mas { velocity = curve(velocity, Threshold, Sensitivity, curvetype); #ifdef DEBUG_DRUM - Serial.print("Hit Cup : "); + Serial.print("[Hit Cup] velocity : "); Serial.print(velocity); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevVel); - Serial.print(", "); + Serial.print(", firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif hitCup = true; @@ -609,17 +620,13 @@ void HelloDrum::cymbal3zoneSensing(byte sens, byte thre, byte scanTime, byte mas else if (firstSensorValue > edgeThreshold && lastSensorValue > edgeThreshold) { #ifdef DEBUG_DRUM - Serial.print("Choke : "); - Serial.print(velocity); - Serial.print(" (raw:"); - Serial.print(prevVel); - Serial.print(", "); + Serial.print("[Choke] firstSensorValue : "); Serial.print(firstSensorValue); - Serial.print(", "); + Serial.print(", lastSensorValue : "); Serial.print(lastSensorValue); - Serial.print("), loopTimes"); + Serial.print("), loopTimes : "); Serial.print(loopTimes); - Serial.print(" ScanTime ms "); + Serial.print(", ScanTime(ms) : "); Serial.println((time_end - time_hit)); #endif choke = true; @@ -742,20 +749,22 @@ void HelloDrum::TCRT5000Sensing(byte sens, byte thre1, byte thre2, byte scanTime void HelloDrum::FSRSensing(byte sens, byte thre, byte scanStart, byte scanEnd, byte pedalSens) { #ifdef ESP32 - int sensRaw = sens * 40; - int thre1Raw = thre * 40; - int ScanStart = scanStart * 40; - int ScanEnd = scanEnd * 40; -#else + fsr = fsr / 4; +#endif + +#ifdef PULLUP + fsr = (1024 - fsr); +#endif + int sensRaw = sens * 10; int thre1Raw = thre * 10; int ScanStart = scanStart * 10; int ScanEnd = scanEnd * 10; -#endif + hit = false; velocity = 0; - openHH = false; - closeHH = false; + //openHH = false; + //closeHH = false; //scan start if (fsr > ScanStart && closeHH == false && pedalVelocityFlag == false && pedalFlag == false) @@ -788,13 +797,14 @@ void HelloDrum::FSRSensing(byte sens, byte thre, byte scanStart, byte scanEnd, b } #ifdef DEBUG_DRUM - Serial.print("Close : "); + Serial.print("[Close] velocity : "); Serial.print(velocity); - Serial.print(" (raw time:"); + Serial.print(" (scan time(ms) : "); Serial.print(prevVel); Serial.println(")"); #endif + hit = true; closeHH = true; openHH = false; pedalFlag = true; @@ -812,7 +822,7 @@ void HelloDrum::FSRSensing(byte sens, byte thre, byte scanStart, byte scanEnd, b if (fsr < ScanEnd && pedalFlag == true) { #ifdef DEBUG_DRUM - Serial.print("Open : "); + Serial.print("[Open] sensorValue : "); Serial.println(fsr); #endif pedalFlag = false; @@ -865,20 +875,14 @@ void HelloDrum::FSRSensing(byte sens, byte thre, byte scanStart, byte scanEnd, b exFSR = fsr; #ifdef DEBUG_DRUM - Serial.print("Move : "); + Serial.print("[Move] sensorValue : "); Serial.print(fsr); - Serial.print(" (raw:"); + Serial.print(" (raw value : "); Serial.print(prevFsr); - Serial.print(")"); - Serial.print(sensRaw); - Serial.print(","); - Serial.print(thre1Raw); - Serial.print(","); - Serial.print(ScanStart); - Serial.print(","); - Serial.print(ScanEnd); - Serial.print(","); - Serial.println(pedalFlag); + Serial.print("), openHH : "); + Serial.print(openHH); + Serial.print(", closeHH : "); + Serial.println(closeHH); #endif } diff --git a/src/hellodrum.h b/src/hellodrum.h index 69d7270..602b441 100644 --- a/src/hellodrum.h +++ b/src/hellodrum.h @@ -1,5 +1,5 @@ /* - " HELLO DRUM LIBRARY" Ver.0.7.4 + " HELLO DRUM LIBRARY" Ver.0.7.5 by Ryo Kosaka