Patrick
Patrick
AArduino
Created by Patrick on 5/11/2025 in #coding-help
Keyboard using keypad and keyboard libraries together
I am trying to make a keyboard script for an stm32 based development board using the keypad and keyboard libraries. I used a default script from the keypad library then added a keyboard function from the keyboard library to send keystrokes to the connected computer. My problem is that the script below does not send any keystrokes. I am able to send a key when I have a keyboard.write function alone, but not when it is inside that if statement. I can also send the pressed letter through serial (using an UNO, not the stm32 board as It doesn't connect to the serial monitor) so I know that the keypad script works alone.
#include <Keyboard.h>
#include <Keypad.h>

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

char hexaKeys[ROWS][COLS] = {
{'A', 'B', 'C'},
{'D', 'E', 'F'},
{'G', 'H', 'I'},
{'J', 'K', 'L'}
};

byte rowPins[ROWS] = {PA2, PA3, PA6, PB1};
byte colPins[COLS] = {PB11, PB14, A9};

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

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

void loop(){
char customKey = customKeypad.getKey();

if (customKey){
//Serial.println(customKey);
Keyboard.write(customKey);
}
}
#include <Keyboard.h>
#include <Keypad.h>

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

char hexaKeys[ROWS][COLS] = {
{'A', 'B', 'C'},
{'D', 'E', 'F'},
{'G', 'H', 'I'},
{'J', 'K', 'L'}
};

byte rowPins[ROWS] = {PA2, PA3, PA6, PB1};
byte colPins[COLS] = {PB11, PB14, A9};

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

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

void loop(){
char customKey = customKeypad.getKey();

if (customKey){
//Serial.println(customKey);
Keyboard.write(customKey);
}
}
1 replies
AArduino
Created by Patrick on 4/6/2025 in #hardware-help
Bidirectional I/O buffer
For something I am making I am going to have each I/O pin of a microcontroller controlling the gate of a transistor or MOSFET. But I also want to use those I/O pins as inputs while only connecting devices to the drain or source of each transistor. Is there a type of transistor that would allow current to flow back through the body to the gate? Or would I need some extra components to do that reliably.
167 replies
AArduino
Created by Patrick on 11/12/2024 in #hardware-help
Custom motor driver module
I am planning to make a high current motor driver module with IRLZ34NPBF mosfets. But I am wondering what components to add to make a nicely working system, like resistors, capacitors, and diodes. I know I need a 10k resistor for the gate to ground, and I know I need diodes from the drain to the vcc. But is there anything else I should have other than those?
722 replies