Closed allthemod closed 2 weeks ago
Hello, @allthemod tried this code and got this error.
error: conversion from 'BLEScanResults*' to non-scalar type 'BLEScanResults' requested 19 | BLEScanResults res =pBLEScan->start(5, false);
I am a beginner so forgive me if this is trivial, but what should i change?
First of all woah you found this two years after I posted it. Second I'll check the code. Third I'm also not that good.
Hello, @allthemod tried this code and got this error.
error: conversion from 'BLEScanResults*' to non-scalar type 'BLEScanResults' requested 19 | BLEScanResults res =pBLEScan->start(5, false);
I am a beginner so forgive me if this is trivial, but what should i change?
What does your ide says?
And are you using platform io?
And are you using platform io?
Arduino IDE.
I fixed the error by the way, initially i downgraded my ESP32 version to the one around your post date and confirmed it worked, then i used copilot to make compatible for the latest version v3.0.5 ... maybe you are still on a prior version? this is the code the worked for me. Thanks for the reply!
`#include
BLEClient* pClient = nullptr;
void setup() { Serial.begin(921600); Serial.println("Starting..."); MyAdvertisedDeviceCallbacks callbackDev = MyAdvertisedDeviceCallbacks(); BLEDevice::init("T-Keyboard client"); BLEScan pBLEScan = BLEDevice::getScan(); pBLEScan->setInterval(1349); pBLEScan->setWindow(449); pBLEScan->setActiveScan(true); BLEScanResults res = pBLEScan->start(5, false); // Change to pointer int count = res->getCount(); // Dereference pointer Serial.printf("count %1d \n", count); for(int i = 0; i < count; i++){ Serial.print(i); Serial.println(" checking..."); callbackDev.onResult(res->getDevice(i)); // Dereference pointer } if(connectToServer()){ Serial.println("We are now connected to the BLE Server."); } delay(5000); }
void loop() {
} `
And are you using platform io?
Arduino IDE.
I fixed the error by the way, initially i downgraded my ESP32 version to the one around your post date and confirmed it worked, then i used copilot to make compatible for the latest version v3.0.5 ... maybe you are still on a prior version? this is the code the worked for me. Thanks for the reply!
`#include
include
include
include
include "TKeyboardClient.h"
BLEClient* pClient = nullptr;
void setup() { Serial.begin(921600); Serial.println("Starting..."); MyAdvertisedDeviceCallbacks callbackDev = MyAdvertisedDeviceCallbacks(); BLEDevice::init("T-Keyboard client"); BLEScan pBLEScan = BLEDevice::getScan(); pBLEScan->setInterval(1349); pBLEScan->setWindow(449); pBLEScan->setActiveScan(true); BLEScanResults res = pBLEScan->start(5, false); // Change to pointer int count = res->getCount(); // Dereference pointer Serial.printf("count %1d \n", count); for(int i = 0; i < count; i++){ Serial.print(i); Serial.println(" checking..."); callbackDev.onResult(res->getDevice(i)); // Dereference pointer } if(connectToServer()){ Serial.println("We are now connected to the BLE Server."); } delay(5000); }
void loop() {
} `
Cool, happy for you and have fun using your esp32 to access your keyboard. It feels really good knowing that somebody used some code I made
This is an example of how to connect your esp32 to your T-keyboard and read keys from it.