Making a RGB 4x4 Sparkfun Keypad for macros - need help !!!!!

ml_pisel

Member
Hi everyone, i'm new to the forum as well as new to teensy ....
I'm using a Teensy 3.5
So basically i would like to make a keypad to record keyboard shortcuts to be used with softwares that i use the most, like autocad, photoshop or even obs studio ....
Anyway, instead of buying new stuff i've started using all electronic pieces that i've already bought through the years and my starting point is a Sparkfun 4x4 button pad with RGB leds.
So my only problem is this:
While keypad matrix code that i'm writing works perfectly for what i have to do ....
I'm not able to find a very simple ways to make those rgb leds turning on.
I'm not looking for something complex, with animations or patterns ..... not even blinking .... i would simply to give each led a precise color, fixed, not fading ... nothing fancy ..... just a color.
And the only problem that i'm facing is that all codes and tutorials that i find online are too new for that board ... or they make something completely different ......

So here is the code that i'm using for the keypad

#include <Keypad.h>
int buttonState = 0;
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1', '2', '3', 'a'},
{'4', '5', '6', 'b'},
{'7', '8', '9', 'c'},
{'*', '0', '#', 'd'}
};


byte rowPins[ROWS] = {16, 36, 32, 25}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 6, 3, 1}; //connect to the column pinouts of the keypad


Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins,
ROWS, COLS );


void setup() {
// Serial.begin(9600);
}

void loop() {
char key = keypad.getKey();

if (key) {
switch (key) {
case '0':
Keyboard.press (KEY_Q);
delay(300);
Keyboard.release (KEY_Q);

break;
case '1':
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(KEY_A);
Keyboard.send_now();
delay(300);
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
break;
}
}
}



Any help would be highly appreciated !!!!
 
PS ... i know wiring it is not my skill ... so be nice IMG_0209.JPGIMG_0210.JPG
 
And just as example .... i'm just looking to make the board appearing like these images .... but nothing ... i'm really lost ... even the sparkfun example doesn't work as described o their website ...

ButtonPad-05-L.jpg

ButtonPad-01-L.jpg
 
Maybe it's this one?

https://www.sparkfun.com/products/8033

If so, I'm afraid I have some bad news. This CAN NOT WORK with the wires connected directly to the LEDs. DO NOT use it with the wires as you've connected them. You could damage your Teensy this way.

As a bare minimum, you must use at least 12 resistors, connected to RED1, BLUE1, GREEN1, RED2, etc. But the Teensy pins are not able to drive enough current to fully light 4 LEDs on a row, and the voltage output is only 3.3V, so the result with only resistors will be not very bright. If you want to try the resistors-only approach, connect 100 ohm resistors between each of those pins and the Teensy.

To do this well, you would need 3.3V to 5V buffer chips, to increase the voltage and allow more current. 74ACT245 would probably work. With this chip, you'd use 120 ohm resistors for the 4 RED signals and 75 ohm resistors for the 8 BLUE and GREEN signals.
 
Thanks for your reply.
I think i'll go for an arduino mega board ..... and use the teensy for another project!!
 
Is there *any* example code for these LEDs, for Mega or any other board?

No matter which board you use, resistors are required, and higher currents are needed if you want full brightness. At least Mega will give you 5V signals, which is a bit easier, but doesn't fully solve everything this LED matrix needs.
 
Back
Top