// This project is based on Moby Pixel's video:
// https://youtu.be/K0cbeFYHCZ8
// Original Code Sketch by Nick Culbertson
// https://gist.github.com/NickCulbertson/7961bb91e27e93dc364bff97dbd79d7e
// Software Needed:
// Teensyduino IDE (Program for running Arduino sketches on Teensy):
// https://www.pjrc.com/teensy/td_download.html
// Arduino Legacy IDE (1.8.X)
// https://www.arduino.cc/en/software
// Libraries Needed:
// Control Surface MIDI Library for Arduino
// https://github.com/tttapa/Control-Surface
// MIDIUSB
// https://github.com/arduino-libraries/MIDIUSB
#include <Control_Surface.h>
USBMIDI_Interface midi;
unsigned int octave = 1;
// Two buttons on the sides that send midi notes on a fixed channel 5. Used for PLAY/REC.
NoteButton button0 {0, {MIDI_Notes::A(octave), CHANNEL_5}};
NoteButton button21 {21, {MIDI_Notes::B(octave), CHANNEL_5}};
// main 16 buttons that send midi notes on channel 1-4, depending on Channel Selection buttons below.
NoteButton button1 {1, {MIDI_Notes::A(octave), CHANNEL_1}};
NoteButton button2 {2, {MIDI_Notes::B(octave), CHANNEL_1}};
NoteButton button3 {3, {MIDI_Notes::C(octave+1), CHANNEL_1}};
NoteButton button4 {4, {MIDI_Notes::D(octave+1), CHANNEL_1}};
NoteButton button5 {5, {MIDI_Notes::E(octave+1), CHANNEL_1}};
NoteButton button6 {6, {MIDI_Notes::F_(octave+1), CHANNEL_1}};
NoteButton button7 {7, {MIDI_Notes::G(octave+1), CHANNEL_1}};
NoteButton button8 {8, {MIDI_Notes::A(octave+1), CHANNEL_1}};
NoteButton button9 {9, {MIDI_Notes::B(octave+1), CHANNEL_1}};
NoteButton button10 {10, {MIDI_Notes::C(octave+2), CHANNEL_1}};
NoteButton button11 {11, {MIDI_Notes::D(octave+2), CHANNEL_1}};
NoteButton button12 {12, {MIDI_Notes::E(octave+2), CHANNEL_1}};
NoteButton button13 {13, {MIDI_Notes::F_(octave+2), CHANNEL_1}};
NoteButton button14 {14, {MIDI_Notes::G(octave+2), CHANNEL_1}};
NoteButton button15 {15, {MIDI_Notes::A(octave+2), CHANNEL_1}};
NoteButton button16 {16, {MIDI_Notes::B(octave+2), CHANNEL_1}};
// 4 Channel Selection buttons. When pressed, main 16 buttons change to the respective midi channel. Respective led lights up. Should not send midi notes.
NoteButton channel1 {17, {MIDI_Notes::F_(octave+3), CHANNEL_1}};
NoteButton channel2 {18, {MIDI_Notes::G(octave+3), CHANNEL_1}};
NoteButton channel3 {19, {MIDI_Notes::A(octave+3), CHANNEL_1}};
NoteButton channel4 {20, {MIDI_Notes::B(octave+3), CHANNEL_1}};
// 4 LEDS that indicate what midi channel is currently selected.
//PINS:
//22 (lights up when channel1 button on pin 17 is pressed)
//23 (lights up when channel2 button on pin 18 is pressed)
//24 (lights up when channel3 button on pin 19 is pressed)
//25 (lights up when channel4 button on pin 20 is pressed)
// One button that switches the orientation of the device from horizontal to vertical and back. Only the main 16 buttons are affected. Shoud not send midi notes.
NoteButton orientationbutton {26, {MIDI_Notes::A(octave), CHANNEL_5}};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
}