You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
what the title says, with my code:
if i pair the esp32 with my pc (win 11) it works fine, if i then pull the power out of the esp32 and re connect the power, it still connects to windows as it should but it dose not send the keys when the buttons are pressed?, not sure if this is a libary issue or my code issue, iv looked all over the internet and even asked chat gpt for help and im coming up with nothing?
this is using the esp32 by espressif systems Ver 2.0.7, my code dose not work if i use 3.05
`
#include <BleKeyboard.h>
// Pin definitions (ensure these match your setup)
const int BUTTON_o_PIN = 12; // Pin for Button L
const int BUTTON_p_PIN = 13; // Pin for Button P
// Create a BleKeyboard object with String parameters
BleKeyboard bleKeyboard("YourDeviceName", "YourManufacturer"); // Pass strings directly
void setup() {
// Initialize Serial for debugging
Serial.begin(115200);
// Initialize the BLE keyboard
bleKeyboard.begin();
// Set button pins as input with pull-up resistor
pinMode(BUTTON_o_PIN, INPUT_PULLUP);
pinMode(BUTTON_p_PIN, INPUT_PULLUP);
}
void loop() {
// Read the current state of the buttons
bool currentButtonLState = digitalRead(BUTTON_o_PIN) == LOW; // Button pressed state
bool currentButtonPState = digitalRead(BUTTON_p_PIN) == LOW; // Button pressed state
// Button L logic
if (currentButtonLState) {
bleKeyboard.press('o'); // Send key press for 'o'
Serial.println("Button L Pressed");
delay(100); // debounce delay
} else {
bleKeyboard.release('o'); // Release key for 'o'
}
// Button P logic
if (currentButtonPState) {
bleKeyboard.press('p'); // Send key press for 'p'
Serial.println("Button P Pressed");
delay(100); // debounce delay
} else {
bleKeyboard.release('p'); // Release key for 'p'
}
// Optional: Small delay to mitigate excessive keypresses
delay(10);
}
`
The text was updated successfully, but these errors were encountered:
what the title says, with my code:
if i pair the esp32 with my pc (win 11) it works fine, if i then pull the power out of the esp32 and re connect the power, it still connects to windows as it should but it dose not send the keys when the buttons are pressed?, not sure if this is a libary issue or my code issue, iv looked all over the internet and even asked chat gpt for help and im coming up with nothing?
this is using the esp32 by espressif systems Ver 2.0.7, my code dose not work if i use 3.05
`
#include <BleKeyboard.h>
// Pin definitions (ensure these match your setup)
const int BUTTON_o_PIN = 12; // Pin for Button L
const int BUTTON_p_PIN = 13; // Pin for Button P
// Create a BleKeyboard object with String parameters
BleKeyboard bleKeyboard("YourDeviceName", "YourManufacturer"); // Pass strings directly
void setup() {
// Initialize Serial for debugging
Serial.begin(115200);
}
void loop() {
// Read the current state of the buttons
bool currentButtonLState = digitalRead(BUTTON_o_PIN) == LOW; // Button pressed state
bool currentButtonPState = digitalRead(BUTTON_p_PIN) == LOW; // Button pressed state
}
`
The text was updated successfully, but these errors were encountered: