Пример #1
0
import sys
import os
sys.path.append(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/src')
from Motor import Controller
import RPi.GPIO as GPIO

if __name__ == '__main__':
    controller = Controller(gyro_address=0x68, gpio_trigger=20, gpio_echo=21)
    try:
        controller.backward(0.5, 100)
    except KeyboardInterrupt:
        controller.stop()
        GPIO.cleanup()
Пример #2
0
import sys
import os
sys.path.append(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/src')
from Motor import Controller
import RPi.GPIO as GPIO

if __name__ == '__main__':
    controller = Controller(gyro_address=0x68, gpio_trigger=20, gpio_echo=21)
    try:
        controller.t_left(80, 2)
    except KeyboardInterrupt:
        controller.stop()
        GPIO.cleanup()
Пример #3
0
from Motor import Controller

if __name__ == '__main__':
    motor = Controller.Controller()
    while True:
        a = raw_input()
        if a == 'w' or a == 'W':
            motor.t_up(100, 0.2)
            motor.t_stop(0)
        elif a == 'a' or a == 'A':
            motor.t_left(100, 0.2)
            motor.t_stop(0)
        elif a == 's' or a == 'S':
            motor.t_down(100, 0.2)
            motor.t_stop(0)
        elif a == 'd' or a == 'D':
            motor.t_right(100, 0.2)
            motor.t_stop(0)
        elif a == '':
            break
        else:
            continue
Пример #4
0
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+'/src')
from Motor import Controller
import RPi.GPIO as GPIO

if __name__ == '__main__':
    controller = Controller(gyro_address=0x68, gpio_trigger=20, gpio_echo=21)
    try:
        controller.t_up(100, 10)
    except KeyboardInterrupt:
        controller.stop()
        GPIO.cleanup()
Пример #5
0
import sys
import os
sys.path.append(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/src')
from Motor import Controller
import RPi.GPIO as GPIO

if __name__ == '__main__':
    controller = Controller(gyro_address=0x68, gpio_trigger=20, gpio_echo=21)
    try:
        controller.turnRight(60, 80)
    except KeyboardInterrupt:
        controller.stop()
        GPIO.cleanup()