ferrygun / Pico_WebBluetooth_Read_Temperature

Pico_WebBluetooth_Read_Temperature
0 stars 2 forks source link

Use namePrefix: "Pico " #1

Open murkle opened 1 year ago

murkle commented 1 year ago

Works very nicely, thanks!

Small improvement maybe? Filters on the device name

let filters = [];
        // name is eg "Pico 28:CD:C1:0B:EA:62"
        filters.push({
            namePrefix: "Pico "
        });
        let options = {
            "optionalServices": ['0000181a-0000-1000-8000-00805f9b34fb']
        };
        options.filters = filters;

        device = await navigator.bluetooth.requestDevice(options);
ferrygun commented 1 year ago

Thanks @murkle Let me update the code.

murkle commented 1 year ago

Thanks! If you're interested I've changed my fork to send the information as JSON (has pros and cons but I like it😀)

https://github.com/ferrygun/Pico_WebBluetooth_Read_Temperature/compare/main...murkle:Pico_WebBluetooth_Read_Temperature:main