Example #1
0
def do_steps():
    global steps_queue

    if steps_queue.qsize() == 0:
        return
    steps = steps_queue.get()
    if (steps > 0):
        step_fun = forward_one_step
        n = steps
    else:
        step_fun = backward_one_step
        n = -steps

    freq = led.get_frequency(config.LED_PORCH)
    dc = led.get_duty_cycle(config.LED_PORCH)
    status = led.get_status(config.LED_PORCH)

    led.turn_on(config.LED_PORCH, 2, 50)

    gpio_lock.acquire()
    for i in range(0, n):
        step_fun(0.01)
    set_motor_input(0, 0, 0, 0)
    gpio_lock.release()

    if status == 'on':
        led.turn_on(config.LED_PORCH, freq, dc)
    else:
        led.turn_off(config.LED_PORCH)
    status_notify()
def do_steps():
    global steps_queue

    if steps_queue.qsize() == 0:
        return;
    steps = steps_queue.get()
    if (steps > 0):
        step_fun = forward_one_step
        n = steps
    else:
        step_fun = backward_one_step
        n = -steps

    freq = led.get_frequency(config.LED_PORCH)
    dc = led.get_duty_cycle(config.LED_PORCH)
    status = led.get_status(config.LED_PORCH)

    led.turn_on(config.LED_PORCH, 2, 50)

    gpio_lock.acquire()
    for i in range(0, n):
        step_fun(0.01)
    set_motor_input(0, 0, 0, 0)
    gpio_lock.release()

    if status == 'on':
        led.turn_on(config.LED_PORCH, freq, dc)
    else:
        led.turn_off(config.LED_PORCH)
    status_notify()
Example #3
0
def get_ht_thread():
    global h
    global t
    while True:
        gpio_lock.acquire()
        ht = dht.read_retry(dht.DHT22, config.DHT22_GPIO_NUM)
        gpio_lock.release()
        h = '{0:0.1f}'.format(ht[0])
        t = '{0:0.1f}'.format(ht[1])
        h = string.atof(h)
        t = string.atof(t)
        time.sleep(2)
Example #4
0
def get_ht_thread():
    global h
    global t
    while True:
        gpio_lock.acquire()
        ht = dht.read_retry(dht.DHT22, config.DHT22_GPIO_NUM)
        gpio_lock.release()
        h = '{0:0.1f}'.format(ht[0])
        t = '{0:0.1f}'.format(ht[1])
        h = string.atof(h)
        t = string.atof(t)
        time.sleep(2)