def connectToMote(): cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() allDevs = detectAllPossible() selectedMoteId = None for d in allDevs: if d in cache.getMotes(): selectedMoteId = d break if selectedMoteId == None: print "No motes found. Device ids:", allDevs, "cacheMoteIds:", cache.getMotes( ).keys() sys.exit() # mote = cache.getMotes().values()[0] mote = cache.getMotes()[selectedMoteId] mote.connect() mote.setLeds(1, 0, 0, 0) mote.startReadThread() mote.irExtendedModeOn() return mote
def connectToMote(): cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() allDevs = detectAllPossible() selectedMoteId = None for d in allDevs: if d in cache.getMotes(): selectedMoteId = d break if selectedMoteId == None: print "No motes found. Device ids:", allDevs, "cacheMoteIds:", cache.getMotes().keys() sys.exit() # mote = cache.getMotes().values()[0] mote = cache.getMotes()[selectedMoteId] mote.connect() mote.setLeds(1,0,0,0) mote.startReadThread() mote.irFullModeOn() return mote
(1, 0, 1, 0), (0, 1, 0, 1), (1, 0, 0, 1), (1, 1, 0, 1), (1, 0, 1, 1), (1, 1, 1, 1), ] def LedTupleFromIndex(i): return ledTuples[i % len(ledTuples)] if __name__ == "__main__": cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() mote = cache.getMotes().values()[0] mote.connect() mote.setLeds(1, 0, 0, 0) time.sleep(2) mote.setLeds(0, 1, 0, 0) time.sleep(2) mote.setLeds(0, 0, 1, 0) time.sleep(2) mote.setLeds(0, 0, 0, 1) time.sleep(2) mote.setLeds(1, 1, 1, 1)
import time import mote from moteCache import MoteCache if __name__ == "__main__": cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() mote = cache.getMotes().values()[0] mote.connect() # mote.rumbleOn() # time.sleep(1) # mote.rumbleOff() time.sleep(1) mote.disconnect()
import time, sys import mote from moteCache import MoteCache if __name__ == "__main__": cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() allDevs = mote.detectAllPossible() selectedMoteId = None for d in allDevs: if d in cache.getMotes(): selectedMoteId = d break if selectedMoteId == None: print "No motes found. Device ids:", allDevs, "cacheMoteIds:", cache.getMotes().keys() sys.exit() # mote = cache.getMotes().values()[0] mote = cache.getMotes()[selectedMoteId] mote.connect() mote.setLeds(1,0,0,0) mote.startReadThread() mote.irBasicModeOn()
import mote from moteCache import MoteCache if __name__ == "__main__": cache = MoteCache() cache.read() # print "GetMotes:", cache.getMotes() for mote in cache.getMotes().values(): print mote.getServices() # Generally: """ [{'protocol': 'L2CAP', 'name': None, 'service-id': None, 'profiles': [('0100', 256)], 'service-classes': ['1000'], 'host': '00:17:AB:32:BF:EF', 'provider': None, 'port': 1, 'description': None}, {'protocol': 'L2CAP', 'name': 'Nintendo RVL-CNT-01', 'service-id': None, 'profiles': [('1124', 256)], 'service-classes': ['1124'], 'host': '00:17:AB:32:BF:EF',
import os import bluetooth import sys from moteCache import MoteCache from mote import detectMotes if __name__ == "__main__": motes = detectMotes() print "Motes:", motes if len(motes) > 0: cache = MoteCache() cache.read() cache.addMotes(motes) cache.write()