Question about Teensy 3.2 + 4x4 sparkfun push button pad

Status
Not open for further replies.

siulun1224

New member
Hi, sorry to bothering everyone, I'm trying to make a midi 4x4 push button pad which I brought from sparkfun. But I still stucking in the tutorial:confused:, I only using the red color of the LED.
(the tutorial link: https://learn.sparkfun.com/tutorials/button-pad-hookup-guide/all#exercise-1-monochrome-leds)

I modify the pins number from the exercise 2 like:

Code:
static const uint8_t btncolumnpins[NUM_BTN_COLUMNS] = {4, 5, 6, 7}; // SWITCH GROUND
static const uint8_t btnrowpins[NUM_BTN_ROWS]       = {0, 1, 2, 3}; // SWITCH
static const uint8_t ledcolumnpins[NUM_LED_COLUMNS] = {8, 9, 10, 11}; //LED GROUND
static const uint8_t colorpins[NUM_LED_ROWS]        = {12, 13, 14, 15}; //RED LED

I confirm much time that I have no circuit connection problems, and the result still seems like something wrong. The serial monitor shows that it seems the part of the matrix has some problem, I push only one button, and four results come out at once.


The result in the serial monitor:

Key Down 12
Key Down 0
Key Down 4
Key Down 8
Key Up 8
Key Up 12
Key Up 0
Key Up 4
Key Down 13
Key Down 1
Key Down 5
Key Down 9
Key Up 1
Key Up 5
Key Up 9
Key Up 13
Key Down 10
Key Down 14
Key Down 2
Key Down 6
Key Up 14
Key Up 2
Key Up 6
Key Up 10
Key Down 3
Key Down 7
Key Down 11
Key Down 15
Key Up 3
Key Up 7
Key Up 11
Key Up 15

If I want it to only light up the button I pressed, what should I do? In addition, if I add some code to make it midi according to this tutorial, will it be very complicated?

I have also tried to use the control surface library to make a midi pad with this 4x4 button pad, but it does not work, I simply modify the pins number from the example:
Code:
#include <Control_Surface.h>

USBMIDI_Interface midi;

// The note numbers corresponding to the buttons in the matrix
const AddressMatrix<4, 4> addresses = {{
  {1, 2, 3, 4},
  {5, 6, 7, 8},
  {9, 10, 11, 12},
  {13, 14, 15, 16},
}};

NoteButtonMatrix<4, 4> buttonmatrix = {
  {0, 1, 2, 3}, // row pins
  {4, 5, 6, 7},    // column pins
  addresses,    // address matrix
  CHANNEL_1,    // channel and cable number
};

void setup() {
  Control_Surface.begin();
}

void loop() {
  Control_Surface.loop();
Can anyone tell me the possible error I'm facing and which way I should think on tackling this problem? Thanks for helping and sorry about my bad english!
 
Last edited:
Status
Not open for further replies.
Back
Top