Beispiel #1
0
    (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)
    mote.setLedsOff()
    time.sleep(1)
    mote.disconnect()
Beispiel #2
0
(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)
    mote.setLedsOff()
    time.sleep(1)
    mote.disconnect()

Beispiel #3
0
    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()

    printPoints = False
    if "print" in sys.argv:
        printPoints = True

    while(1):
        if printPoints:
            pts = mote.extractNormalizedPoints() 
            if len(pts) > 0:
                print pts
        time.sleep(1)
Beispiel #4
0
    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 = Mote(id="00:19:1D:79:93:E0")
    mote.connect()

    mote.setLeds(1,0,0,0)

    mote.startReadThread()
    mote.irBasicModeOn()

    while(1):
        time.sleep(0.1)
        events =  mote.extractButtonEvents()
        if len(events) != 0:
            print events

    mote.disconnect()