adafruit / Adafruit_Keypad

light keypad library for arduino
23 stars 10 forks source link

Adafruit_Keypad_Ringbuffer compile error #13

Open dboe opened 2 years ago

dboe commented 2 years ago

When compiling the example code with a 5x4 matrix keypad: "(h)ttps://content.instructables.com/FUL/940T/ITCHJSHC/FUL940TITCHJSHC.png?auto=webp&frame=1&fit=bounds&md=b48f1a46b2a6504146c867cb936fb32a"

I get the following error/warning:

"Arduino/libraries/Adafruit_Keypad/Adafruit_Keypad_Ringbuffer.h:57:5: note: type 'struct Adafruit_Keypad_Ringbuffer' should match type 'struct Adafruit_Keypad_Ringbuffer' Adafruit_Keypad_Ringbuffer;"

CODE USED:

include

const byte ROWS = 5; // rows const byte COLS = 4; // columns //define the symbols on the buttons of the keypads char keys[ROWS][COLS] = { {'L','0','R','E'}, {'7','8','9','S'}, {'4','5','6','D'}, {'1','2','3','U'}, {'A','B','#','*'} };

byte rowPins[ROWS] = {17, 18, 19, 20, 21}; //connect to the row pinouts of the keypad byte colPins[COLS] = {0, 1, 2, 3}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad Adafruit_Keypad customKeypad = Adafruit_Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);

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

void loop() {

customKeypad.tick();

while(customKeypad.available()){ keypadEvent e = customKeypad.read(); Serial.print((char)e.bit.KEY); if(e.bit.EVENT == KEY_JUST_PRESSED) Serial.println(" pressed"); else if(e.bit.EVENT == KEY_JUST_RELEASED) Serial.println(" released"); } }