Beispiel #1
0
def main():
    try:
        joystick = init_pygame()
    except Exception:
        print "Pygame initialization failed - it MIGHT require (for unknown reasons) root"
        print "You can try with root, but that won't be safer"
        print
        raise

    pi = pigpio.pi()

    pump = Pump(pi, pin=config.PIN_PUMP)
    pump.off()
    robot = Robot(pi, config.PIN_SERVO1, config.PIN_SERVO2, config.PIN_SERVO3)
    robot.disable()

    control = Control(joystick, pump, robot)
    try:
        control.loop()
    finally:
        pump.off()
Beispiel #2
0
def main():
    try:
        joystick = init_pygame()
    except Exception:
        print "Pygame initialization failed - it MIGHT require (for unknown reasons) root"
        print "You can try with root, but that won't be safer"
        print
        raise

    pi = pigpio.pi()

    pump = Pump(pi, pin=config.PIN_PUMP)
    pump.off()
    robot = Robot(pi, config.PIN_SERVO1, config.PIN_SERVO2, config.PIN_SERVO3)
    robot.disable()

    control = Control(joystick, pump, robot)
    try:
        control.loop()
    finally:
        pump.off()
Beispiel #3
0
def main_loop():
    pi = pigpio.pi()
    pump = Pump(pi)
    pump.off()
    robot = Robot(pi)

    try:
        robot.enable()
        for x, y, power, volume in program:
            robot.set(x, 0, y)
            pump.set_power(power)
            sleep(ROBOT_DELAY)
            pump.on()
            sleep(volume)
            pump.off()
            sleep(PUMP_DELAY)
    finally:
        print "Disabling pump"
        pump.off()
        robot.disable()
Beispiel #4
0
def main_loop():
    pi = pigpio.pi()
    pump = Pump(pi)
    pump.off()
    robot = Robot(pi)

    try:
        robot.enable()
        for x, y, power, volume in program:
            robot.set(x, 0, y)
            pump.set_power(power)
            sleep(ROBOT_DELAY)
            pump.on()
            sleep(volume)
            pump.off()
            sleep(PUMP_DELAY)
    finally:
        print "Disabling pump"
        pump.off()
        robot.disable()