Skip to content

Instantly share code, notes, and snippets.

@loginov-rocks
Created August 27, 2018 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loginov-rocks/c88f7eed3bfaa8685b594a2e19813a43 to your computer and use it in GitHub Desktop.
Save loginov-rocks/c88f7eed3bfaa8685b594a2e19813a43 to your computer and use it in GitHub Desktop.
How to make a web app for your own Bluetooth Low Energy device? Step 14
function send(data) {
data = String(data);
if (!data || !characteristicCache) {
return;
}
writeToCharacteristic(characteristicCache, data);
log(data, 'out');
}
function writeToCharacteristic(characteristic, data) {
characteristic.writeValue(new TextEncoder().encode(data));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment