New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need help to add the led with button #68
Comments
The buttons are separate from the LEDs. First get the buttons working as shown in this example: https://tttapa.github.io/Control-Surface-doc/Doxygen/d4/d53/NoteButtonMatrix_8ino-example.html You could edit the Control-Surface/src/MIDI_Outputs/Abstract/MIDIButtonMatrix.hpp Lines 38 to 44 in ec1382b
For wiring, it's probably easiest to use a MAX7219 to drive the 64 LEDs. This chip is supported by the library: https://tttapa.github.io/Control-Surface-doc/Doxygen/de/de9/classAH_1_1MAX7219.html#details |
Maybe i use the 64 rgb strip, the one thing make me stuck that how to control led similar to launchpad |
You can use the Examples:
|
I need help to add the 2 buttons change the octave of 64 buttons matrices can you add the example of 64 button matrices with change bank? |
Something like this? #include <Control_Surface.h>
USBMIDI_Interface midi;
// Transposer that transposes one octave (12 semitones) at a time,
// from -2 to +2 octaves.
Transposer<-2, +2> transposer(12);
// Push buttons on pins 7 and 8 to transpose up/down.
IncrementDecrementSelector<5> selector = {transposer, {7, 8}};
AddressMatrix<2, 3> notes = {{
{0, 1, 2},
{3, 4, 5},
}};
Bankable::NoteButtonMatrix<2, 3> buttons = {
transposer, // bank/transposer
{2, 3}, // row pins (outputs, driven low-Z low !)
{4, 5, 6}, // column pins (inputs, hi-Z)
notes, // note numbers
CHANNEL_1, // MIDI channel / cable
};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
} Also here. |
RainbowColorMapper> midiled = {leds, note(C, 2)};
https://store.djtechtools.com/products/midi-fighter-64-b-stock
|
The color is determined by the velocity of the note event and the color mapper you use. If you change the velocity in Ableton, you change the color. What do you mean you can't add the note C#2? C#2 == Db2. |
Note that it's much more efficient to use a range of notes than an array with many notes: |
Here is my code for 2 leds from 64 buttons:
|
I don't understand what you're trying to do. Please elaborate. The CRGB array is an array of colors, not an array of notes. |
I want to create the 64 WS2812 leds, when push the buttons with note from 36 to note 99 and the leds is bright follow from the note 36 to 99. So i can map the led with ableton drumrack color and the rainbow effect. Can you help to fix the code? |
You just specify the start note and the length for the NoteRange class. A single instance handles all notes in that range. #include <FastLED.h>
// Must be before Control Surface to enable FastLED features of Control Surface
#include <Control_Surface.h>
// Define the array of leds.
Array<CRGB, 64> leds = {};
// 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 = {{
{36, 37, 38, /* ... */ },
{ /* ... */ },
{ /* ... */ 97, 98, 99},
// (fill in yourself)
}};
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);
}
};
// Range from note 36 to 99 (= 36 + leds.length - 1)
NoteRangeFastLED<leds.length, RainbowColorMapper> midileds = {leds, 36};
void setup() {
// See FastLED examples and documentation for more information.
FastLED.addLeds<NEOPIXEL, ledpin>(leds.data, leds.length);
FastLED.setCorrection(TypicalPixelString);
midileds.setBrightness(128);
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
FastLED.show();
} |
You can change the mapping for the button matrix relatively easily by changing the address matrix. However, the LEDs are a bit harder. You have to map the index in this function to the correct LED: Control-Surface/src/MIDI_Inputs/LEDs/FastLED.hpp Lines 56 to 60 in 55066c6
By default, it assumes that the LEDs are in order. If the range begins at 36, note 36 corresponds to index 0, which corresponds to the first LED of the strip ( |
https://www.amazon.co.uk/Matrix-WS2812-Integrated-Drivers-Arduino/dp/B07SPJTR3J After that i plan to wire the 64 single ws2812 to the bottom of case. |
I added the necessary functionality to map the index in the FastLED strip. For now, you can try the code I posted in #68 (comment), but you can use your custom address matrix if you want to. |
I got this old 8x8 ws2812b from my friend, it can use 49 leds because the 15 leds is die, i use the #68 yesterday code but when i sent the note from ableton is not bright, so i use the example of Note-FastLED is working: https://www.youtube.com/playlist?list=PLM73Vxl0lUzYDwQaUVTjygPYLP4thouRw |
I'm not sure I understand what you mean. |
When i touch the note C4 from ableton keyboard, the led is not working ( i tested with midiox ) |
I'm afraid I can't help you with that. What channel are you using? How are you routing and mapping the MIDI in Ableton? |
If you're using channel 3, you have to use NoteRangeFastLED<leds.length, RainbowColorMapper> midileds = {leds, {36, CHANNEL_3}}; |
Can i change the velocity of button matrix? |
You can pass the velocity as an optional parameter to the constructor or use the setter: You have full control over the LEDs if you want to, so you can create any effect you want. |
I adding the velocity 127 but this line is not working:
I press the note 36 from button matrix the led not bright, and i adding the basic
I think the light just recive the note (C, 2) and the 36 not work |
The LEDs won't react to button presses unless your DAW loops back the note messages, there's no direct link between the button matrix and the LEDs. Please try to understand the parameters you use, they are explained in the documentation.
This is note 36 on channel 3.
This is note 36 on the default channel (CHANNEL_1). |
I found the solution: Can you adding to the library for arduino and teensy 2.0 ? |
All functionality of the repo you linked to is supported by the Control Surface library, I don't understand what you mean. |
If is supported, how can i add with button matrix? :( |
I think you have a misconception somewhere. The button matrix and the LEDs are completely separate. The button matrix sends messages to Ableton when you press a button. The LED range listens for messages from Ableton, and turns on/off the LED accordingly. Try to get the buttons and the LEDs to work separately first, the code has already been posted, you just have to select the correct address (note number and channel). |
It's very hard to help you like this. You have to keep in mind that I don't have Ableton, I don't have the same hardware, I have no idea what code you've tried or what you're doing in Ableton. Try to ask specific questions, and carefully explain what you're doing. |
How can i use this code with matrix button to your library? #include "MIDIUSB.h" const byte _NLED = 64; #include <Adafruit_NeoPixel.h> const byte _R[128] = {0, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 45, 93, 142, 223, 190, 28, 61, 93, 190, 125, 12, 28, 45, 158, 61, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 0, 0, 0, 125, 0, 12, 28, 45, 158, 61, 28, 61, 93, 190, 125, 45, 93, 142, 223, 190, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 61, 125, 190, 255, 255, 36, 73, 109, 146, 182, 219, 255}; void setup() { void loop() { void setLED(byte pitch, byte velocity) { void noteOff(byte channel, byte pitch, byte velocity) { void wipe(){ |
I want to add LEDs that light up when a button is pressed with 64 buttons matrices method, can you help me with wiring schematic of 8x8 button matrix adding led ?
Here is my code: https://drive.google.com/file/d/1YqwD8hrNIjD1ZXY6R81CUqa7pewemvzq/view?usp=drivesdk
Is that important to add the diodes with this code?
The text was updated successfully, but these errors were encountered: