Пример #1
0
def init_movehub():
    mh = MoveHub(MY_MOVEHUB_ADD, 'BlueZ', MY_BTCTRLR_HCI)
    mh.start()
    mh.subscribe_all()
    mh.listen_hubtilt(MODE_HUBTILT_BASIC)
    mh.listen_colordist_sensor(PORT_D)
    mh.listen_angle_sensor(PORT_C)

    if mh.is_connected():
        print(('Is connected: ', mh.is_connected()))
    return mh
Пример #2
0
#!/usr/bin/env python3

from pyb00st.movehub import MoveHub
from pyb00st.constants import *

from time import sleep

import os

MY_MOVEHUB_ADD = os.environ.get('MYMOVEHUB')
MY_BTCTRLR_HCI = 'hci0'

mymovehub = MoveHub(MY_MOVEHUB_ADD, 'BlueZ', MY_BTCTRLR_HCI)

try:
    mymovehub.start()
    mymovehub.subscribe_all()
    mymovehub.listen_hubtilt(MODE_HUBTILT_BASIC)

    while True:
        print('Is connected: ', mymovehub.is_connected())
        sleep(1)

finally:
    mymovehub.stop()