Example #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))
Example #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(_)
Example #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)
Example #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)
Example #5
0
def humi(addr=None):
    return command(slot(addr, 2), b'get_humi', 1)
Example #6
0
def temp(addr=None):
    return command(slot(addr, 2), b'get_temp', 1)
Example #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))
Example #8
0
def motor(val, addr=None):
    return command(slot(addr, 20), b'get%s%c' % ('bf'[val > 0], abs(val) // 4))
Example #9
0
def get_t(addr):
    return C(slot(addr, 26), b'getT', 2)
Example #10
0
def get_p(addr):
    return C(slot(addr, 26), b'getP', 2)
Example #11
0
def get_a(addr):
    return C(slot(addr, 26), b'getA', 2)
Example #12
0
def value(addr=None):
	return command(slot(addr,6),b'get_mic_val',2)
Example #13
0
def value(addr=None):
	return command(slot(addr,5),b'get_light_val',2)
Example #14
0
def clear(addr=None):
    command(slot(addr, 1), b'ClearScreen')
    sleep(15)
Example #15
0
def on(addr=None):
    command(slot(addr, 3), b'set_led_on')
Example #16
0
def value(addr=None):
	return command(slot(addr,8),b'get_distance_val',2)
Example #17
0
def off(addr=None):
    command(slot(addr, 3), b'set_led_off')
Example #18
0
def value(addr=None):
    return command(slot(addr, 4), b'get_poten_val', 2)
Example #19
0
def get(addr=None):
    return command(slot(addr, 9), b'get_touch', 1)
Example #20
0
def get_voice_id(addr):
    return C(slot(addr, 33), b'get_command', 1)