Working with the LEDs

(Leonard Cuff) #1

I’ve just now got the Arduino app installed and have successfully tweaked my keyboard layout. Yay! I’m now wanting to make it possible to turn the LEDS on to red with one key, and then turn them off with another key. (or make the LED key toggle between these two states.) I’m not sure how to proceed. I see all sorts of header files in the page inside the Arduino map, but I can’t find those header files. Do I need to do a git download? What’s the best (easiest) way to proceed?

0 Likes

(Leonard Cuff) #2

I’ve been trying to help myself, and have made some progress, but could still use some help:

I found elsewhere on this site, a hint on how to set LED lights a particular color. It works to put

solid.Red.activate()

at the end of Kaleidoscope.setup() , but when I try to define a macro to call it from
a particular key, the compiler gives me an error message solidRed was not declared in this scope.

static void turnRed(uint8_t key_state) {
solidRed.activate(); // gives ‘not declared in this scope’ message
}

void setup() {
// First, call Kaleidoscope’s internal setup function
Kaleidoscope.setup();

Kaleidoscope.use(
// The boot greeting effect pulses the LED button for 10 seconds after the keyboard is first connected
&BootGreetingEffect,

// The hardware test mode, which can be invoked by tapping Prog, LED and the left Fn button at the same time.
&TestMode,

// LEDControl provides support for other LED modes
&LEDControl,

// We start with the LED effect that turns off all the LEDs.
&LEDOff,

... other stuff ...

// These static effects turn your keyboard's LEDs a variety of colors
&solidRed, &solidOrange, &solidYellow, &solidGreen, &solidBlue, &solidIndigo, &solidViolet,

... and more stuff 

solidRed.activate();  // works!

);

0 Likes

(Leonard Cuff) #3

And, after exploring a little more, I realized that the call solidRed.activate() can only be made AFTER the following declaration. Shazaam, it now works.

static kaleidoscope::LEDSolidColor solidRed(160, 0, 0);

1 Like