Ejemplo n.º 1
0
    print("NormalMode")

try:
    while True:
        if (Killing == False):
            if (GPIO.input(AutoMode) == False):
                tf = 5
                distance()
                MoveForward(tf)
            else:
                bd = BlueDot()
                bd.when_pressed = dpad
                bd.when_moved = dpad
                bd.when_released = stop
                #bd.when_double_pressed = quit
                bd.when_client_connects = BDConnect
                bd.when_client_disconnects = BDDisConnect
                bd.wait_for_connection = BDDisConnect

                pause()

        if (GPIO.input(KillSwitch) == False):
            if (Killing == True):
                print("KillSwitch-", Killing)
                Killing = False
                time.sleep(1.0)
            else:
                print("KillStop-", Killing)
                Killing = True
                stop()
                time.sleep(1.0)
Ejemplo n.º 2
0
def moved(pos):
    print("Moved: x={} y={}".format(pos.x, pos.y))

def swiped(swipe):
    print("Swiped: up={} down={} left={} right={} speed={}".format(swipe.up, swipe.down, swipe.left, swipe.right, swipe.speed))

def double_presed(pos):
    print("Double pressed: x={} y={}".format(pos.x, pos.y))

def client_connected():
    print("connected callback")

def client_disconnected():
    print("disconnected callback")

dot.when_client_connects = client_connected
dot.when_client_disconnects = client_disconnected
dot.when_pressed = pressed
dot.when_released = released
dot.when_moved = moved
dot.when_swiped = swiped
dot.when_double_pressed = double_presed

dot.start()

dot.wait_for_press()
print("wait for press")
dot.wait_for_move()
print("wait for move")
dot.wait_for_release()
print("wait for release")
Ejemplo n.º 3
0
import yaml
from runner import Runner
from bluedot import BlueDot
from signal import pause

config = yaml.safe_load(open("config.yaml", 'r'))

bd = BlueDot()
runner = Runner(bd, config)

bd.when_client_connects = runner.check_mac_addresses
bd.when_pressed = runner.rotate

pause()