//vuha.hau@hyper.vn /////////////////////////////////collum //-------BANK 2----||-------BANK 4----- //{64, 65, 66, 67, || 96, 97, 98, 99}, // row //{60, 61, 62, 63, || 92, 93, 94, 95}, //{56, 57, 58, 59, || 88, 89, 90, 91}, //{52, 53, 54, 55, || 84, 85, 86, 87}, //==================================== //------BANK 1-----||-------BANK 3----- //{48, 49, 50, 51, || 80, 81, 82, 83}, //{44, 45, 46, 47, || 76, 77, 78, 79}, //{40, 41, 42, 43, || 72, 73, 74, 75}, //{36, 37, 38, 39, || 68, 69, 70, 71} ////////////////////////////////////// #include // Must be before Control Surface to enable FastLED features of Control Surface #include // Define the array of leds. Array leds = {64, 65, 66, 67, 96, 97, 98, 99, 60, 61, 62, 63, 92, 93, 94, 95, 56, 57, 58, 59, 88, 89, 90, 91, 52, 53, 54, 55, 84, 85, 86, 87, 48, 49, 50, 51, 80, 81, 82, 83, 44, 45, 46, 47, 76, 77, 78, 79, 40, 41, 42, 43, 72, 73, 74, 75, 36, 37, 38, 39, 68, 69, 70, 71}; // The data pin with the strip connected. constexpr uint8_t ledpin = 0; USBMIDI_Interface midi; // The note numbers corresponding to the buttons in the matrix const AddressMatrix<8, 8> addresses = {{ //////////////////////////////collum {10, 11, 12, 13, A0, A1, A2, A3} (left to right) {64, 65, 66, 67, 96, 97, 98, 99}, // row {2, 3, 4, 5, 6, 7, 8, 9} (up to down) {60, 61, 62, 63, 92, 93, 94, 95}, {56, 57, 58, 59, 88, 89, 90, 91}, {52, 53, 54, 55, 84, 85, 86, 87}, {48, 49, 50, 51, 80, 81, 82, 83}, {44, 45, 46, 47, 76, 77, 78, 79}, {40, 41, 42, 43, 72, 73, 74, 75}, {36, 37, 38, 39, 68, 69, 70, 71} }}; NoteButtonMatrix<8, 8> buttonmatrix = { {2, 3, 4, 5, 6, 7, 8, 9}, // row pins {10, 11, 12, 13, A0, A1, A2, A3}, // column pins addresses, // address matrix CHANNEL_3, // channel and cable number }; // Create a functor that maps the velocity and the index of a note to a color. struct RainbowColorMapper { CHSV operator()(uint8_t velocity, uint8_t index) const { return CHSV(255 * index / leds.length, 255, 2 * velocity); } }; using namespace MIDI_Notes; NoteRangeFastLED midiled36 = {leds, note(C, 2)}; NoteRangeFastLED midiled37 = {leds, note(Db, 2)}; void setup() { // See FastLED examples and documentation for more information. FastLED.addLeds(leds.data, leds.length); FastLED.setCorrection(TypicalPixelString); midiled36.setBrightness(128); midiled37.setBrightness(128); Control_Surface.begin(); } void loop() { Control_Surface.loop(); FastLED.show(); }