Created
November 15, 2016 05:43
-
-
Save qdot/86ff28790bd7cfcf4e4d854829b7dd79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.bluetooth.requestDevice({filters: [{ services: ['6e400001-b5a3-f393-e0a9-e50e24dcca9e']}]}).then((device) => { d = device }); | |
d.gatt.connect().then(server => s = server).catch(er => { console.log(er) }); | |
s.getPrimaryService('6e400001-b5a3-f393-e0a9-e50e24dcca9e').then(service => ser = service); | |
ser.getCharacteristic('6e400002-b5a3-f393-e0a9-e50e24dcca9e').then(char => c = char); | |
c.writeValue(new TextEncoder('ASCII').encode("Vibrate:20;")).then(l => console.log("sent!")).catch(e => console.log(e)); | |
c.writeValue(new TextEncoder('ASCII').encode("Vibrate:0;")).then(l => console.log("sent!")).catch(e => console.log(e)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment