Comments on: ESP32 Web Bluetooth (BLE): Getting Started Guide https://randomnerdtutorials.com/esp32-web-bluetooth/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 18 Dec 2024 19:17:01 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Anders Oleander https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-992543 Wed, 18 Dec 2024 19:17:01 +0000 https://randomnerdtutorials.com/?p=135306#comment-992543 In reply to Sara Santos.

Hi Sara

I tried this tutorial with platformIO and VS Code and version 3 of the above example and it doesn’t work. (VS code and PlatformIO updated to the last version).

( Error message: conversion from ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} to non-scalar type ‘String’ requested )

When trying version 2 it works lika a dream…
Best regards
Anders Oleander
Sweden

]]>
By: Wim https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-987049 Wed, 27 Nov 2024 12:10:59 +0000 https://randomnerdtutorials.com/?p=135306#comment-987049 Hello, very cool tutorial, but:
I simply can’t understand it. There are many tutorials on ESP32 and BLE, but none of them really cover security.
For devices that are reachable via the air, this is the first thing I think about!
It would be really nice if you could expand on the example and at least add the possibility of a static PIN.
Thank you!

]]>
By: betmen https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-982997 Wed, 13 Nov 2024 18:56:03 +0000 https://randomnerdtutorials.com/?p=135306#comment-982997 In reply to SERGIO A S AGUIAR.

String value = pLedCharacteristic->getValue();
change to
std::string value = pLedCharacteristic->getValue();

]]>
By: André https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-978752 Thu, 31 Oct 2024 10:02:38 +0000 https://randomnerdtutorials.com/?p=135306#comment-978752 Hello, Thank you for your response on the subject that you sent me in link, “https://randomnerdtutorials.com/esp32-web-bluetooth/”
I tested it, it’s great, but I would like to add the reading of a potentiometer and a voltage, which is displayed on my PC, despite all my attempts I am stuck on this subject, bluetooth is simpler for me, but I don’t see how to send the data to an HTML page,
Thank you, your site is great
André

]]>
By: André https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-976659 Mon, 28 Oct 2024 16:22:56 +0000 https://randomnerdtutorials.com/?p=135306#comment-976659 Bonjour comment lire plusieurs valeurs de l’ESP32 sur la page html, par exemple les valeur d’un capteur de température DHT11

Good morning
I’m starting, how to read several values ​​from the ESP32 on the html page, for example the values ​​of a DHT11 temperature sensor
thanks in advance

]]>
By: Seti https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-975759 Thu, 24 Oct 2024 19:34:56 +0000 https://randomnerdtutorials.com/?p=135306#comment-975759 In reply to SERGIO A S AGUIAR.

I believe the led value is binary value not a string so you can’t do String value = … it’s not a string, hope that helps!

]]>
By: SERGIO A S AGUIAR https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-975744 Thu, 24 Oct 2024 17:36:46 +0000 https://randomnerdtutorials.com/?p=135306#comment-975744 I am getting this error when I try to compile the esp32s3 code:

/private/var/folders/8h/by6_jkqs2yx2fw89mdxrkcvh0000gn/T/.arduinoIDE-unsaved2024924-70222-1oax92m.allt/sketch_oct24b/sketch_oct24b.ino: In member function ‘virtual void MyCharacteristicCallbacks::onWrite(BLECharacteristic*)’:
/private/var/folders/8h/by6_jkqs2yx2fw89mdxrkcvh0000gn/T/.arduinoIDE-unsaved2024924-70222-1oax92m.allt/sketch_oct24b/sketch_oct24b.ino:39:46: error: conversion from ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} to non-scalar type ‘String’ requested
String value = pLedCharacteristic->getValue();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

exit status 1

Compilation error: conversion from ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} to non-scalar type ‘String’ requested

Any clues about it?

Thanks a lot for the tutorial. and the code.

]]>
By: Tec https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-957171 Sat, 14 Sep 2024 09:10:43 +0000 https://randomnerdtutorials.com/?p=135306#comment-957171 Fixed.
Add function: buffer_str

function buffer_str(tex) {
var ArrBuf = new ArrayBuffer(tex.length);
var VerBuffer = new Uint8Array(ArrBuf);
for (var i=0, texLen=tex.length; i<texLen; i++) {
VerBuffer[i] = tex.charCodeAt(i);
}
return ArrBuf;
}

Change function writeOnCharacteristic: return characteristic.writeValue(buffer_str(value+”\n”))

function writeOnCharacteristic(value){
if (bleServer && bleServer.connected) {
bleServiceFound.getCharacteristic(ledCharacteristic)
.then(characteristic => {
console.log(“Found the LED characteristic: “, characteristic.uuid);
return characteristic.writeValue(buffer_str(value+”\n”))
})
.then(() => {
latestValueSent.innerHTML = value;
console.log(“Value written to LEDcharacteristic:”, value);
})
.catch(error => {
console.error(“Error writing to the LED characteristic: “, error);
});
} else {
console.error (“Bluetooth is not connected. Cannot write to characteristic.”)
window.alert(“Bluetooth is not connected. Cannot write to characteristic. \n Connect to BLE first!”)
}
}

]]>
By: Tec https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-956888 Fri, 13 Sep 2024 18:04:13 +0000 https://randomnerdtutorials.com/?p=135306#comment-956888 Good morning, excellent tutorial, my question is:
In the html file, in the function writeOnCharacteristic(value) can a string be sent instead of a number?
How would the change be in the function writeOnCharacteristic(value)?
Thank you very much

]]>
By: Samuel https://randomnerdtutorials.com/esp32-web-bluetooth/#comment-956855 Fri, 13 Sep 2024 16:20:08 +0000 https://randomnerdtutorials.com/?p=135306#comment-956855 Hello! Excelent tutorial. I have a question, how do you do to send a string/json from the web app to the board. Ican doit it from the esp32 to the web app but not in the other way, it only accepts int. Thanks!!

]]>