BLE Scan And BLE Keyboard - Arduino Forum Home » Arduino Ble Keyboard.h » BLE Scan And BLE Keyboard - Arduino Forum Maybe your like Arduino Ble Library Hm-10 Arduino Ble Master Slave Arduino Ble Mqtt Arduino Ble Multiple Clients Arduino Ble Nano 33 BLE Scan and BLE keyboard Projects Programming enthusiastsr September 29, 2021, 9:00am 1 Hello, My task is to scan a Bluetooth and send a message to the monitor whenever the scanned Bluetooth device is found. For this purpose my ESP32 should act as a keyboard. Also I have an LED interfaced, that blinks whenever the Bluetooth is detected. I am able to scan and detect the bluetooth, and also blink the LED. But however when I tried to use BLEkeyboard, the loop isnot executed with the condition bleKeyboard.isConnected(). My questions are how do I know why this "if condition" is not satisfied and where can I read my bleKeyboard.print output? I have posted my code below, please help me with your inputs. Thank you. #include <BleKeyboard.h> /* Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp Ported to Arduino ESP32 by Evandro Copercini */ #include <BLEDevice.h> #include <BLEUtils.h> #include <BLEScan.h> #include <BLEAdvertisedDevice.h> BleKeyboard bleKeyboard; String Address = "58:ba:01:ef:ba:12"; const int Pin = 2; int scanTime = 5; //In seconds static BLEAddress *pServerAddress; BLEScan* pBLEScan; class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str()); if (advertisedDevice.getAddress().equals(*pServerAddress)) { Serial.println("Device Match"); digitalWrite (Pin, HIGH); advertisedDevice.getScan()->stop(); } // Found our server else { Serial.println("Device Mismatch"); digitalWrite (Pin, LOW); } } }; void setup() { Serial.begin(115200); Serial.println("Scanning..."); Serial.println("Starting BLE Keyboard"); //Begin the BLE keyboard/start advertising the keyboard (so phones can find it) bleKeyboard.begin(); pinMode(Pin, OUTPUT); pServerAddress = new BLEAddress(Address.c_str()); BLEDevice::init(""); pBLEScan = BLEDevice::getScan(); //create new scan pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster pBLEScan->setInterval(100); pBLEScan->setWindow(99); // less or equal setInterval value } void loop() { if (bleKeyboard.isConnected()) { Serial.println("Sending 'Hello world'..."); bleKeyboard.print("Hello world"); bleKeyboard.print(" "); pBLEScan->start(scanTime, false); pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory delay(2000); } } system Closed March 28, 2022, 9:00am 2 This topic was automatically closed 180 days after the last reply. New replies are no longer allowed. Related topics Topic Replies Views Activity Nano Esp32 bleKeyboard isConnected, Does Not Print Over BLE General Guidance 1 426 September 22, 2024 Arduino Nano ESP32 BleKeyboard Not Sending Data General Guidance 4 548 September 17, 2024 ESP32 keyboard help Programming 5 831 June 14, 2023 ESP32 BLE Keyboard always connects and reconnects Programming 2 332 October 5, 2025 Ble keyboard paired but not connecting Programming 1 206 December 31, 2024 Tag » Arduino Ble Keyboard.h ESP32 BLE Keyboard Library - GitHub Mbed BLE HID - Arduino Reference Using An Arduino Nano BLE 33 As A BLE Keyboard? - Arduino Forum How To Turn Nicla Sense ME Into BLE Keyboard - Arduino Forum Nano33 BLE Sense Data As Keyboard Output - Arduino Forum ESP32 BLE HID Keyboard Bluetooth HID Using Just An ESP32 (inc Bluetooth Macro Keypad) Mouse And Keyboard Control Using TinyUSB And BLE ESP32_BLE_Arduino Vs ESP32-BLE-Keyboard - LibHunt BleKeyboard - ESP32 Forum Mbed BLE HID - Arduino Library List ESP32 As Bluetooth Keyboard - Electronics Club, IIT Madras Arduino Nano BLE 33 Default Example Sketch `USBHID>Keyboard ... ESP32 Bluetooth Low Energy (BLE) On Arduino IDE