This is correct. I can't seem to find any I2C libraries like the one from Adafruit, so you'll either have to find an alternative or use a bare LCD without the I2C, like the ones here:but this library is written in C++
http://www.adafruit.com/products/398
http://www.adafruit.com/products/399
https://www.sparkfun.com/products/10862
But those will require quite a few pins. (6 for the text, 3 for the backlight, 9 in total without VCC/GND/contrast) So you might want to use a Teensy++ 2.0 which will give you more than enough pins, and use AVR libraries for the HD44780 driver. (Google it.)
If you look in my keymap I have only 2 layers. One default for a normal qwerty layout, and a second one that is for F1-F12, media keys, etc, etc. To change the color I need to activate said layer (FN0) and press FN1-FN7.If i understand correctly your are using FN keys to change RBG values for your strip
So to change to orange for example I need to press FN1 while on the second layer, holding FN0.
'id' takes whatever you put after 'ACTION_FUNCTION()'. If you put 'ACTION_FUNCTION(5)', then id=5.ACTION_FUNCTION can take 2 parameters, but for the id parameter, what are the different "values" that id can take?
I just made it easier for me to define each 'backlight mode' as a number, like you see in the beginning of my keymap file:
Code: Select all
#define BACKLIGHT_MODE1 1
#define BACKLIGHT_MODE2 2
#define BACKLIGHT_MODE3 3
#define BACKLIGHT_MODE4 4
.....
I asked about BACKLIGHT_MODE2 and not just FN2 because BACKLIGHT_MODE2 is what gets passed, since FN2 has no value.
[2] = ACTION_FUNCTION(BACKLIGHT_MODE2) means send 'BACKLIGHT_MODE2' to 'ACTION_FUNCTION' when FN[2] is pressed.
I don't use switch case often, but I think that'll work too. If not you can always put curly brackets between cases.
Code: Select all
switch (id)
{
case FN1:
{
lcd.print("FN1 activated");
lcd.setbacklight(RED);
break;
}
case FN2:
{
lcd.print("FN2 activated");
lcd.setbacklight(GREEN);
break;
}
....