i’ve been working on this for the past couple days, and struggling to understand it, but i think i can help a little.
the pattern of pin numbering will depend on how you wired it up. to find a pattern, just print pin number in a debug message to the mios studio terminal. you can easily figure out what the pin states mean by printing the value too.
led is a lot more tricky, but the answer is where the notes turn the leds on and off. connect your midi keyboard and start hitting notes, eventually you’ll see your leds start to light up. use different velocities to change the colors. look at this section of the code:
if( midi_package.event == NoteOff || velocity == 0x00 ) {
// Note Off or velocity == 0x00: clear both LEDs
blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;
#endif
} else if( velocity < 0x40 ) {
// Velocity < 0x40: set green LED, clear red LED
blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;
DEBUG_MSG(“green - mod_ix: %d row_ix: %d col_ix: %d mask: %d”, led_mod_ix, led_row_ix, led_column_ix, led_mask);
#endif
} else if( velocity < 0x60 ) {
// Velocity < 0x60: clear green LED, set red LED
blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;
DEBUG_MSG(“red - mod_ix: %d row_ix: %d col_ix: %d mask: %d”, led_mod_ix, led_row_ix, led_column_ix, led_mask);
#endif
} else {
// Velocity >= 0x60: set both LEDs
blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;
DEBUG_MSG(“both - mod_ix: %d row_ix: %d col_ix: %d mask: %d”, led_mod_ix, led_row_ix, led_column_ix, led_mask);
#endif
those DEBUG_MSG lines are all mine (put #define DEBUG_MSG MIOS32_MIDI_SendDebugMessage in mios32_config.h if you don’t have it there). i’m still in the process of decoding this for my own purposes (my blm doesn’t match the normal layout), but you’ll see the patterns that are being used for column, row, and mod. pay attention to the 0/1 at the end of blm_scalar_led, and the way the operators are used against led_mask. that is resetting the state of the led, and turning on the correct color based on velocity.
i’m still in the process of figuring this out myself, so i’m sorry i can’t completely explain things. but this should point you in the right direction.
ultra