Arduino Pro Micro macropad not working

Hey, Im brand new to arduino and coding in general, and I was able to pull this code together, based off of a sample code for a similar macropad, for a 12 button macropad.

#include <Keyboard.h>

#include <Encoder.h> 
Encoder RotaryEncoderA(14, 15);

#include <Keypad.h>

const byte ROWS = 4; 
const byte COLS = 4; 

char keys[ROWS][COLS] = {
  {'1', '2', '3', '4'},   
  {'5', '6', '7', '8'},
  {'9', '0', 'A', 'B'},  
};

int modePushCounter = 0;  
int buttonState = 0;         
int lastButtonState = 0;     

long positionEncoderA  = -999; 

const int ModeButton = A0;    
const int Mode1= A2;
const int Mode2= A3; 

byte rowPins[ROWS] = {4, 5, A3 };
byte colPins[COLS] = {6, 7, 8, 9 };  
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
  pinMode(ModeButton, INPUT_PULLUP);  
  Serial.begin(9600); 
  pinMode(Mode1,OUTPUT); digitalWrite(Mode1,LOW);
  pinMode(Mode2,OUTPUT); digitalWrite(Mode2,LOW);
  
  Serial.begin(9600);
  Keyboard.begin();
}

void loop() {
char key = keypad.getKey();
      Serial.println(key);
      digitalWrite(Mode1,LOW); digitalWrite(Mode2,LOW);
       if (key) {
    Serial.println(key);
    switch (key) {
      case '9': 
        Keyboard.press(KEY_LEFT_GUI); 
        Keyboard.print('d');
        break;
      case '0':
        Keyboard.press(KEY_LEFT_GUI); 
        Keyboard.print('d'); 
        break;
      case 'A':
        Keyboard.press(KEY_LEFT_ALT); 
        Keyboard.press(KEY_F4); 
        break;
      case 'B':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.print('a'); 
        break;
      case '5':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.print('z');
        break;
      case '6':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.press(KEY_LEFT_SHIFT);
        Keyboard.print('z');
        break;
      case '7':
        Keyboard.press(KEY_LEFT_ALT); 
        Keyboard.press(KEY_TAB); 
        break;
      case '8':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.press(KEY_LEFT_ALT);
        Keyboard.press(KEY_DELETE); 
        break;
      case '1':
        Keyboard.press(0x7F); 
        break;
      case '2': 
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.print('c');
        break;
      case '3':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.print('x');
        break;
      case '4':
        Keyboard.press(KEY_LEFT_CTRL); 
        Keyboard.print('v');
        break;
    }
    delay(100); Keyboard.releaseAll();
       }
  }

The code uploads to the Pro micro no problem, however, when I press the keyboard switches, nothing happens.

Any help would be appreciated!

what are your changes? looks just like Keypad example

Just changed the rows! Thank you! The original code had multiple layers and 2 rotary encoders, Im going to add 1 rotary encoder in once I figure out the easier macro buttons.

Any reason why nothing happens when I load the code on? None of the actual macros ive coded work when I press the buttons.

so, you pull nothing together, only delete some lines.

does it work in original variant?

No, not even the original code does anything on the macropad

well, do you able to check connectivity of keypad if it broken or something

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.