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
(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) time.sleep(2)
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()