Giter VIP home page Giter VIP logo

p5.ble.js's People

Contributors

armsp avatar honnet avatar yining1023 avatar zhujingwen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p5.ble.js's Issues

float64 type doesn't work

Calling for .read() or .startNotifications() using 'float64' as the data type causes a sketch to fail.

Sample:

myBLE.startNotifications(characteristic, myHandler, 'float64');

error:

crashes on line 40 of p5.ble.js

Cannot use examples in p5 web editor

Trying to use the examples in the p5 web editor I constantly get an error:

Error: SecurityError: requestDevice() called from cross-origin iframe.

the examples code work fine if I run them locally.

Multiple services

Multiple services

Hi,
I like this project, but I can't find a way to get values from characteristics in different services. Did I miss something?
best regards and thank you for the work

Docs upate

On this page of the docs, please update this:

<script src="https://unpkg.com/[email protected]/dist/p5.ble.js" type="text/javascript"></script>

To this:

<script src="https://unpkg.com/[email protected]/dist/p5.ble.js" type="text/javascript"></script>

Or to the current version. It causes problems for float32 data and bigEndian data.

Unable to access more than 4 byte characteristic

I am working with Health Thermometer Service (UUID: 0x1809) I have enabled read and notify properties of the Temperature Measurement characteristic (UUID: 0x2A1C) which sends 5 byte data in SFLOAT format. I am using .read() api but the size of given datatype parameter is not enough to read the complete value.

I have tried using uint32 which shows 1 byte less. I have tried using float64 but the read value is always zero. Can you please suggest work around how to read the complete temperature data? Basically what I want to know is how to read large characteristics (say 100 byte long).

Writing string to characteristic?

Hi, I'm wondering if you could provide a function to write a string to a characteristic? On line 104 you use the Uint8Array.of() function to parse the input value, in that case we can't write a string to a characteristic. Perhaps it can be changed to something like:

const bufferToSend = new Uint8Array(toUTF8Array(inputValue));

so we can send value to the device? If it's a design choice, could you please let me know the reason for this? Thank you!

Connecting on ESP32

Hi there. Love this library!!
Just trying to get it to work with ESP32. No luck connecting to advertised service UUID.

On my phone using the BLE Scanner app, I can see and connect to my service. But don't see the service listed from browser using myBLE.connect(serviceUuid, gotCharacteristics). Just hangs and says "no compatible devices found."

The code for ESP32 is quite different from your sample code for Arduino, but at the end of the day, it advertises a serviceUUID and that's confirmed working... so don't think there's too much to go wrong.

Bug? Or am I doing something wrong? Does it need something else in that ArduinoBLE.h library? (I'm not using that library). I'm using:
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

Uncaught TypeError: Cannot read property 'requestDevice' of undefined

Hi there,

I'm trying to run the multiple characteristics example, but receiving an error in the browser console. The device I'm trying to connect to is an ESP32 running a BLE test code that has 1 service and 2 characteristics. The ESP32 is able to be connected to through other BLE apps. The example has been modified with the device's service and characteristic UUIDs.

Here is the output from the browser console:

p5.ble.js:51 Requesting Bluetooth Device...

p5.ble.js:53 Uncaught TypeError: Cannot read property 'requestDevice' of undefined
    at p5ble.connect (p5.ble.js:53)
    at connectAndStartNotify (sketch.js:37)
    at p5.Element.eventPrependedFxn (p5.js:49425)

Would you happen to know what's the cause, or if there's any way to fix this?

Thanks!

Options object not working

Thanks for the library!
I am using version 0.0.6. (Have also tried 0.0.4 and 0.0.5)
Creating an options object and using it directly instead of a serviceUuid is not working.

Any attempt at using an options object give the following errors:

Please pass in a serviceUuid string or option object, e.g. options = { filters: [{ services: [serviceUuid] }]} 
Requesting Bluetooth Device... 
Error: TypeError: Failed to execute 'requestDevice' on 'Bluetooth': Either 'filters' should be present or 'acceptAllDevices' should be true, but not both.
characteristics:  
undefined
There is no device connected.

The options objects I am trying to use have been tested using the Chrome demo page:
https://googlechrome.github.io/samples/web-bluetooth/device-info.html
For example, the following filter works just fine to scan all the BBC micro:bits in the vicinity using the Chrome demo code but does not work with P5Ble (same error as above):
options = {filters:[{namePrefix:"BBC"}]}
Also options = {acceptAllDevices: true} works fine on the Chrome demo page.

Sending float values from Arduino Nano 33 BLE doesn't seem to work

I got this wonderful library working with the new Arduino Nano 33 BLE. However sending float values seems to have an issue. For example these are the float values as reported in my serial montior and the corresponding float values received by p5.ble.js

Serial Monitor p5.ble.js received value
1.22 5.933522291385966e-39
1.16 1.0338756247714607e-38
0.92 8.854321548098327e-39
0.73 1.177619700203129e-38
1.28 1.528288335057325e-39
1.46 1.1822114750110285e-38
6.53 2.321725105554387e-38

I am using the ArduinoBLE library. And sending float values using BLEFloatCharacteristic and receiving them in p5.ble.js using myBLE.read(myCharacteristic, 'float32', gotValue);

Notifications started but no events fired on iOS

Hello, thanks a lot for creating this library. It's really good and it's been working great. I'm using it with nRF52840 feather express board and UART service to communicate. I'm working on a web-app, which needs to function on iOS; however, chrome nor safari supports the Bluetooth APIs. I installed WebBle, Bluefly and other browsers that do support the Bluetooth APIs. On those browsers, I can successfully connect to the Bluetooth device, but I never receive the data. It appears that the event 'characteristicvaluechanged' might not be getting fired. I do see this log in the console printed.

console.log('> Notifications started');

Below is the code that I have. Any pointers or help will be useful.
Warmly,
Amay

  // Read UART characteristics. 
  handleCharacteristics(error, characteristics) {
      if (error) {
          console.log('error: ', error);
          return; 
      }

      this.myTxCharacteristic = characteristics[0]; 
      this.myRxCharacteristic = characteristics[1];

      this.myBLE.startNotifications(this.myRxCharacteristic, this.handleIncomingData.bind(this), 'string');

      this.isReceivingData = true; 
      console.log("BLE: Successfully paired. Ready to communicate.")
  }

About NetworkError: GATT operation already in progress.

Hi all. I'm trying to send notifications in the draw function but I keep receiving "NetworkError: GATT operation already in progress". If I lower down the framerate the issue will be solved. I believe it is because the p5 sketch is sending notifications too fast and the BLE has a delay. I am wondering if that is possible to have a boolean function that detects whetehr there is anything busy or in the queue. Many thanks!

Start Stop Notifications example on Arduino 101 doesn't work

I noticed that the "Start Stop Notifications example" with Arduino 101 doesn't work. it threw out the following error.
Screen Shot 2019-08-04 at 2 56 39 PM

I also tested the Notification example with Web BLE(on macOS) on Arduino 101, it also doesn't work, the error is: GATT Error, not supported:
Screen Shot 2019-08-04 at 3 34 21 PM

This example was working fine a few months ago, I wonder what changed. I also found this discussion in the google group: https://groups.google.com/a/chromium.org/forum/#!topic/web-bluetooth/TlHnA3hTksw.

Maybe it's still working fine on other devices? @tigoe and @ZhuJingwen

Auto Reconnect?

Great library, but been trying to get a reconnect project working. Occasionally, my device will disconnect, so I'd like it to just reconnect as soon as possible. On the Chrome BLE sample projects, they do have an example, and that does work... only problem is that the service and characteristics need to be retrieved again? And how can you do this without relaunching the scanner window?
https://googlechrome.github.io/samples/web-bluetooth/automatic-reconnect.html

So upon a successful reconnect, I tried to start notifications on a characteristic, but get an error:
p5.ble.js:11166 Uncaught (in promise) DOMException: Characteristic with UUID c97f391f-a6c4-4778-afac-05f797bbdc5f is no longer valid. Remember to retrieve the characteristic again after reconnecting.

Any ideas how this can work? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.