Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

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

  1. #1
    Junior Member
    Join Date
    Jun 2018
    Posts
    5

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

    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 !!!!

  2. #2
    Junior Member
    Join Date
    Jun 2018
    Posts
    5
    PS ... i know wiring it is not my skill ... so be niceClick image for larger version. 

Name:	IMG_0209.JPG 
Views:	31 
Size:	84.7 KB 
ID:	13998Click image for larger version. 

Name:	IMG_0210.JPG 
Views:	42 
Size:	134.7 KB 
ID:	13999

  3. #3
    Junior Member
    Join Date
    Jun 2018
    Posts
    5
    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 ...

    Click image for larger version. 

Name:	ButtonPad-05-L.jpg 
Views:	29 
Size:	41.8 KB 
ID:	14000

    Click image for larger version. 

Name:	ButtonPad-01-L.jpg 
Views:	31 
Size:	117.3 KB 
ID:	14001

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Can you give us a link to the Sparfun product page, hopefully with the schematic and other documentation?

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    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.

  6. #6
    Junior Member
    Join Date
    Jun 2018
    Posts
    5
    Thanks for your reply.
    I think i'll go for an arduino mega board ..... and use the teensy for another project!!

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    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.

  8. #8
    Junior Member
    Join Date
    Jun 2018
    Posts
    5
    Only codes that are quite doing something are those that iíve found on this page:

    https://learn.sparkfun.com/tutorials...d-hookup-guide

    But the only result that i get is that i have all red leds on.... and thatís it!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •