TroubleshootingBluno

Bluno with Web Bluetooth: startNotifications() fails

userHead r03ert0 2022-05-18 15:13:27 1392 Views4 Replies

Hello!

I'm building a web app for controlling a little toy robot. I got a Bluno, and the pairing, etc., works nicely, however, I'm stuck with an error when I try to startNotifications().

The error seems to be the one that's described in this question from 6 years ago: https://www.dfrobot.com/forum/topic/2035

Is there a fix for that, or a workaround that people may have find out?

Thank you very much in advance for your help!

 

 

2023-08-02 03:02:58

 

```html

 

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>bluetooth test</title></head><body>    <button id="scan">scan</button>    <button id="disconnect">disconnect</button>    <button id="reconnect">reconnect</button>    <button id="send">send</button>    <script>        var bluetoothDevice = null;        var Bcharacteristic = null;        document.querySelector('#scan').addEventListener("click", () => {            navigator.bluetooth.requestDevice({                optionalServices: ["0000dfb0-0000-1000-8000-00805f9b34fb"],                acceptAllDevices: true,            })                .then(device => {                    // Human-readable name of the device.                    console.log('Connecting to GATT Server...');                    bluetoothDevice = device;                    // Attempts to connect to remote GATT Server.                    return bluetoothDevice.gatt.connect(); })                .then(server => {                    // Getting Service…                    console.log('Getting Service...');                    return server.getPrimaryService('0000dfb0-0000-1000-8000-00805f9b34fb');                })                .then(service => {                    // Getting Characteristic…                    console.log('Getting Characteristic...');                    return service.getCharacteristic('0000dfb2-0000-1000-8000-00805f9b34fb');                })                .then(characteristic => {                    return characteristic.startNotifications();                })                .then(characteristic => {                    characteristic.addEventListener('characteristicvaluechanged',                        handleCharacteristicValueChanged);                    console.log('Notifications have been started.');                })                .catch(error => { console.error(error); });        })```

 

userHeadPic MyeongJin.Jeong
jenna wrote:

Hi!

 

We generally use ArduinoIDE to program the Bluno. But your code doesn't seem to be ArduinoC. Could you pls tell me more details?

2023-08-02 14:52:22
1 Replies
2023-08-02 03:02:12

did you solve this problem? 

I ran into the same problem while working on a project.

 I've been looking for a way for a week now, but I couldn't find one. 

There was no reference anywhere that said it was solved. 

 

did you solve it? Can you tell me how you solved it?

Below is part of the code I wrote. Here, the error occurred at line 39.

 

userHeadPic MyeongJin.Jeong
2022-06-16 17:00:41

Hi! What exactly do you want to achieve? What are the specific problems or errors encountered?

userHeadPic Tonny12138