Skip to content

Instantly share code, notes, and snippets.

@ampledata
Created December 14, 2014 10:18
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 ampledata/48d7cfe984a8dba37dfd to your computer and use it in GitHub Desktop.
Save ampledata/48d7cfe984a8dba37dfd to your computer and use it in GitHub Desktop.
example nano script
import pygatt
str_buf = ''
def print_str_buf(x,y):
global str_buf
str_y = "%s" % y
if str_y == '$':
print str_buf
sb = str_y
else:
str_buf = str_buf + str_y
pygatt.util.reset_bluetooth_controller()
bgn = pygatt.pygatt.BluetoothLEDevice('00:07:80:71:D5:89')
bgn.connect()
bgn.char_write(32, bytearray([0x03, 0x00]))
bgn.subscribe('a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b', print_str_buf)
bgn.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment