OMOTE/Platformio/lib/ESP32-BLE-Keyboard/examples/SendKeyStrokes/SendKeyStrokes.ino
Klaus Musch 7ba79d5c92
Modular approach - first version for main branch (#60)
* first version of "modular-approach"

* changed keyboard commands for HOME and BACK

* Update README.md

* only some typos in comments

* readability

* comment for what the mqtt keyboard is used

* removed numbering of tab variables. not needed anymore

* changed the default keyboard from "´mqtt keyboard" to "BLE keyboard"

* updated to latest version of keypad library from Github, changes for inverted logic are explicitely marked

* added comment for key repeatModes

* added comment for MQTT keyboard

* setting timout via GUI now works, not only dropdown without functionality

* BLE indicator added; separation of BLE/WiFi activation from activation of devices using it

* report battery level to BLE device

* Dynamic keyboard commands, so you can safely deactivate BLE and/or WiFi and not break the example code

* reorganized files into folders

* moved lv_conf.h into the gui folder

* added devices for appleTV and smarthome

* assets.c broken up and placed them where they are used

* added support for IR RC5

* reorganization of files and folder

* added comment

* renamed assets files

* introduction of gui_registry

* removed unnecessary functions from sleep.h

* use gui_registry.h only once

* some files renamed for better understandability

* minor renaming

* some more renaming

* check if WiFi label was instantiated before using it

* introduction of a scene registry

* save prefs directly after timeout is changed

* renaming of preferencesStorage

* comment added

* only readability

* detailled definition of key layout for the diferrent scenes

* made code compile for "device_smarthome" when WiFi is deactivated

* fixed access violation when no scene was active

* added support for IR DENON commands

* increased lvgl heap from 32K to 48K
2024-02-12 19:57:51 +01:00

46 lines
1.1 KiB
C++

/**
* This example turns the ESP32 into a Bluetooth LE keyboard that writes the words, presses Enter, presses a media key and then Ctrl+Alt+Delete
*/
#include <BleKeyboard.h>
BleKeyboard bleKeyboard;
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleKeyboard.begin();
}
void loop() {
if(bleKeyboard.isConnected()) {
Serial.println("Sending 'Hello world'...");
bleKeyboard.print("Hello world");
delay(1000);
Serial.println("Sending Enter key...");
bleKeyboard.write(KEY_RETURN);
delay(1000);
Serial.println("Sending Play/Pause media key...");
bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE);
delay(1000);
//
// Below is an example of pressing multiple keyboard modifiers
// which by default is commented out.
/*
Serial.println("Sending Ctrl+Alt+Delete...");
bleKeyboard.press(KEY_LEFT_CTRL);
bleKeyboard.press(KEY_LEFT_ALT);
bleKeyboard.press(KEY_DELETE);
delay(100);
bleKeyboard.releaseAll();
*/
}
Serial.println("Waiting 5 seconds...");
delay(5000);
}