Skip to content

Commit

Permalink
Update minimalDrumkit.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
RyoKosaka authored May 20, 2018
1 parent 2ae2d50 commit 86329b0
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion examples/minimalDrumKit/minimalDrumkit.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
EXAMPLE - Minimal Drum Kit (kick Snare Hihat)
EXAMPLE - Minimal Drum Kit (kick Snare Hihat Ride)
With this sample code, you can make minimal drum kit.
Expand All @@ -8,6 +8,7 @@
Piezo for snare to A1.
Piezo for hihat to A2.
TCRT5000 for hihat controller to A3
Yamaha PCY135/155 to A4,A5
Buttons Circuit:
Button for EDIT to digital pin 6
Expand Down Expand Up @@ -46,6 +47,7 @@ HelloDrum kick(0);
HelloDrum snare(1);
HelloDrum hihat(2);
HelloDrum hihatControl(3);
HelloDrum ride(4, 5);

//Set the DIGITAL pin number to which the button and the LCD are connected.
HelloDrumButton button(6, 7, 8, 9, 10); //(EDIT,UP,DOWN,NEXT,BACK)
Expand All @@ -66,6 +68,7 @@ void setup() {
snare.settingName("SNARE");
hihat.settingName("HIHAT");
hihatControl.settingName("HIHAT PEDAL");
ride.settingName("RIDE");


//Load settings from EEPROM.
Expand All @@ -74,6 +77,7 @@ void setup() {
snare.loadMemory();
hihat.loadMemory();
hihatControl.loadMemory();
ride.loadMemory();
}

void loop() {
Expand All @@ -87,6 +91,7 @@ void loop() {
snare.settingEnable();
hihat.settingEnable();
hihatControl.settingEnable();
ride.settingEnable();


////////// 2. SENSING & SENDING MIDI////////////
Expand All @@ -98,16 +103,19 @@ void loop() {
hihatControl.TCRT5000();

//Sending MIDI signals.
//KICK//
if (kick.hit == true) {
MIDI.sendNoteOn(kick.note, kick.velocity, 10); //(note, velocity, channel)
MIDI.sendNoteOff(kick.note, 0, 10);
}

//SNARE//
if (snare.hit == true) {
MIDI.sendNoteOn(snare.note, snare.velocity, 10); //(note, velocity, channel)
MIDI.sendNoteOff(snare.note, 0, 10);
}

//HIHAT//
if (hihat.hit == true) {
//check open or close
//1.open
Expand All @@ -122,6 +130,7 @@ void loop() {
}
}

//HIHAT CONTROLLER//
//when hihat is closed
if (hihatControl.closeHH == true) {
MIDI.sendNoteOn(hihatControl.note, hihatControl.velocity, 10); //(note of pedal, velocity, channel)
Expand All @@ -133,4 +142,32 @@ void loop() {
MIDI.sendControlChange(4, hihatControl.pedalCC, 10);
}

//RIDE//
//1.bow
if (ride.hit == true) {
MIDI.sendNoteOn(ride.note, ride.velocity, 10); //(note, velocity, channel)
MIDI.sendNoteOff(ride.note, 0, 10);
}

//2.edge
else if (ride.hitRim == true) {
MIDI.sendNoteOn(ride.noteRim, ride.velocity, 10); //(note, velocity, channel)
MIDI.sendNoteOff(ride.noteRim, 0, 10);
}

//3.cup
else if (ride.hitCup == true) {
MIDI.sendNoteOn(ride.noteCup, ride.velocity, 10); //(note, velocity, channel)
MIDI.sendNoteOff(ride.noteCup, 0, 10);
}

//4.choke
if (ride.choke == true) {
MIDI.sendPolyPressure(ride.note, 127, 10);
MIDI.sendPolyPressure(ride.noteRim, 127, 10);
MIDI.sendPolyPressure(ride.noteCup, 127, 10);
MIDI.sendPolyPressure(ride.note, 0, 10);
MIDI.sendPolyPressure(ride.noteRim, 0, 10);
MIDI.sendPolyPressure(ride.noteCup, 0, 10);
}
}

0 comments on commit 86329b0

Please sign in to comment.