How does one make a key that turns the LEDs off?

Both of these can be done with a macro. For the first, to turn all LEDs off, a macro like the following will work:

static void turnLEDsOff(uint8_t key_state) {
  if (keyToggledOn(key_state)) {
    LEDOff.activate();
  }
}

For the second, there are at least two ways : you can either jump to an index, or to a particular mode (by name). The first using LEDControl.set_mode(n), where n is the index of the mode. The index will be the same as the LED effect order in Kaleidoscope.use() (counting only the LED effects). Or, you can call, say, LEDRainbowWaveEffect.activate(). Both of these from a macro much like the example above.

To use these as macros, add, say, MACRO_LED_OFF to the macro enum in your sketch, and use M(MACRO_LED_OFF) in your keymap, and add a case statement in macroActions, similar to the existing ones.

Hope this helps!

5 Likes