示例#1
0
from sys import argv
from sys import exit
from SenseHandler import SenseHandler

sense = SenseHandler()

#last argument is the light status
lightstatus = argv[1]

for i in range(2,len(argv)):
    lightId = int(argv[i])

    if(lightstatus == "on"):
        sense.turn_on_light(lightId, [0,255,0])
    elif(lightstatus ==  "off"):
        sense.turn_off_light(lightId)
    else:
        print "unknown light status for lightId " + lightID
示例#2
0
from SenseHandler import SenseHandler

sense = SenseHandler()

sense.get_temperature()
示例#3
0
from sys import argv
from sys import exit
from SenseHandler import SenseHandler

# checks numbers of input
if(len(argv) < 3):
	print "Not enough params"
	exit(1)


lightid = argv[1]
lightstatus = argv[2]

sense = SenseHandler()

if(lightid == "lside"): # left side
	pixels = sense.get_pixels()
        for i in range(0,64,8):
            for j in range(i, i+4,1):
                pixels[j] = [0,255,0]
            for j in range(i+4, i+8,1):
                pixels[j] = [0,0,0]
	sense.set_pixels(pixels)

elif (lightid == "allamb"):
	pixels = sense.get_pixels()
        for i in range(0,64,1):
            pixels[i] = [0,0,153]
	sense.set_pixels(pixels)