I'm having some trouble finding the syntax on how to write to a custom characteristic. Here's my code. I have no idea what to do next. I'm trying to write to a0521000-2a63-479e-9d0a-09dfa7c8fd98 with the following command (in hex): 00 01 00 00 00 01 80 00 00 00 00 00 00 00 00 00 00 00 00 00
Thanks for any help.
<script>
document.querySelector(".unlock").addEventListener("click", function () {
navigator.bluetooth
.requestDevice({
filters: [{ name: "IL8A2" }],
optionalServices: ["a0521000-2a63-479e-9d0a-09dfa7c8fd98"],
})
.then((device) => {
console.log("> Name: " + device.name);
console.log("> Id: " + device.id);
console.log("> Connected: " + device.gatt.connected);
})
.then((server) =>
server.getPrimaryService("a0521000-2a63-479e-9d0a-09dfa7c8fd98")
)
.then((service) =>
service.getCharacteristic("a0521001-2a63-479e-9d0a-09dfa7c8fd98")
)
NOW WHAT????
})
.catch((error) => {
console.log("Argh! " + error);
});
});
</script>