Example #1
0
 class BTconnect:
   chars = {}
   def __init__(self):
     try:
       self.p = Peripheral(BULB)
       characteristics = self.p.getCharacteristics()
       for c in characteristics:
         self.chars[c.getHandle()] = c
     except BTLEException as e:
       print str(e)
     
   def read_by_handle(self, handle):
     return self.chars[handle].read()
   
   def write_by_handle(self, handle, data):
     self.chars[handle].write(data, True)
Example #2
0
File: pi.py Project: dhong44/HVAC
from btle import Peripheral, UUID

simblee = Peripheral('CC:9B:84:26:0F:AC', 'random')

serviceUUID = UUID('2A00')

char = simblee.getCharacteristics(uuid = serviceUUID)[0]

char.write('Simblee')

print char.read()

simblee.disconnect()