Once paired HC-05 will just transmit the information they get to the other side.
So the Arduino connected to the keypad (keyboard matrix) can be a simple arduino running a dumbed down code, with the master HC-05 attached (after uploading the code) to pin 0 and 1 (Serial)
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 3;
const char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
const byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
const byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(38400); // whatever baud rate is used for talking to your HC-05
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
then on the other side you need two Serial lines, one for the slave HC-05 and one that will be used to connect the USB cable so that you appear as a HID device (keyboard) to your host computer.
This only works with certain Arduinos (32u4 or SAMD micro based boards) and the keyboard library enables to send keystrokes to an attached computer through their micro’s native USB port.
if you use a pro-micro then you have only one Serial port, so you will need to use Software Serial.
something as simple as this would probably work:
#include <SoftwareSerial.h>
SoftwareSerial HC05Serial(2, 3); // RX | TX --> connect to pin 2 and 3
const byte securityPin = 4; // to activate the keyboard function, pin 4 needs to be connected to GND
void setup()
{
pinMode(securityPin, INPUT_PULLUP);
Keyboard.begin();
HC05Serial.begin(38400); // whatever baud rate you configured don't go too fast
}
void loop()
{
int r = HC05Serial.read();
if (r != -1) { // -1 means nothing received
if (r >= '0' && r <= '9') || r == '*' || r == '#') { // is it really a correct character
if (digitalRead(securityPin) == LOW) Keyboard.write((char) r); // to be on the safe side
}
}
}
Note that the keyboard documentation mentions to be careful
A word of caution on using the Mouse and Keyboard libraries: if the Mouse or Keyboard library is constantly running, it will be difficult to program your board. Functions such as Mouse.move() and Keyboard.print() will move your cursor or send keystrokes to a connected computer and should only be called when you are ready to handle them. It is recommended to use a control system to turn this functionality on, like a physical switch or only responding to specific input you can control. Refer to the Mouse and Keyboard examples for some ways to handle this.
--> that's why I'm adding a test on pin #4 to see if it's connected to ground. for this to work you need that wire / switch installed. if somethings goes weird, disconnect from ground and no input will be sent to your PC.
There are tons of documentation on how to configure two HC-05 to work as a master and slave devices, so make sure they are paired before connecting them to both Arduinos.
(all code typed here an totally untested
- see that as a conceptual approach to your need)