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
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()
from moteCache import MoteCache from mote import detectAllPossible if __name__ == "__main__": devices = detectAllPossible() print "Devices:", devices