예제 #1
0
def show(y, x, string, addr=None):
    if isinstance(string, bytes):
        command(slot(addr, 1), b'DisplayGB2312,%d,%d,' % (y, x) + string[:16])
    else:
        string = str(string)[:16]
        command(slot(addr, 1), b'DisplayGB2312,%d,%d,%s' % (y, x, string))
    sleep(len(string))
예제 #2
0
def time(addr=None):
    t = command(slot(addr, 36), b'getT', 6, 1)
    if not t:
        return t
    for i in range(6):
        _[i] = t[i] - 1
    return tuple(_)
예제 #3
0
def values(addr=None):
    data = command(slot(addr, 7), b'get_key_val', 9, True)
    if isinstance(data, bytes):
        return conv(data)
    if data == None:
        return None, None
    return tuple(conv(i) for i in data)
예제 #4
0
def temp_humi(addr=None):
    res = command(slot(addr, 2), b'get_temp_humi', 2)
    if isinstance(res, int):
        t, h = res // 256, res % 256
        if t >= 128: t -= 256
        return t, h
    if res == None:
        return None, None
    _res.clear()
    for rr in res:
        t, h = rr // 256, rr % 256
        if t >= 128: t -= 256
        _res.append((t, h))
    return tuple(_res)
예제 #5
0
def humi(addr=None):
    return command(slot(addr, 2), b'get_humi', 1)
예제 #6
0
def temp(addr=None):
    return command(slot(addr, 2), b'get_temp', 1)
예제 #7
0
def set_time(Y, M, D, h, m, s, addr=None):
    command(slot(addr, 36), b"setT%c%c%c%c%c%c" % (Y, M, D, h, m, s))
예제 #8
0
def motor(val, addr=None):
    return command(slot(addr, 20), b'get%s%c' % ('bf'[val > 0], abs(val) // 4))
예제 #9
0
def get_t(addr):
    return C(slot(addr, 26), b'getT', 2)
예제 #10
0
def get_p(addr):
    return C(slot(addr, 26), b'getP', 2)
예제 #11
0
def get_a(addr):
    return C(slot(addr, 26), b'getA', 2)
예제 #12
0
def value(addr=None):
	return command(slot(addr,6),b'get_mic_val',2)
예제 #13
0
def value(addr=None):
	return command(slot(addr,5),b'get_light_val',2)
예제 #14
0
def clear(addr=None):
    command(slot(addr, 1), b'ClearScreen')
    sleep(15)
예제 #15
0
def on(addr=None):
    command(slot(addr, 3), b'set_led_on')
예제 #16
0
def value(addr=None):
	return command(slot(addr,8),b'get_distance_val',2)
예제 #17
0
def off(addr=None):
    command(slot(addr, 3), b'set_led_off')
예제 #18
0
def value(addr=None):
    return command(slot(addr, 4), b'get_poten_val', 2)
예제 #19
0
def get(addr=None):
    return command(slot(addr, 9), b'get_touch', 1)
예제 #20
0
def get_voice_id(addr):
    return C(slot(addr, 33), b'get_command', 1)