예제 #1
0
    for event in gamepad.read_loop():
        print(Lenkung())
        if Lenkung() is not None:
            Lenkrad = Lenkung()
        if RTrigger() is not None:
            gas = RTrigger()
        if LTrigger() is not None:
            brake = LTrigger()
        if Lenkrad <= -30000:
            if gas >= 1:
                tire.run_left(gas)
            elif brake >= 1:
                tire.back_left(brake)
        elif Lenkrad >= 30000:
            if gas >= 1:
                tire.run_right(gas)
            elif brake >= 1:
                tire.back_right(brake)
        elif gas >= 1:
            tire.run(gas)
        elif brake >= 1:
            tire.back(brake)
        elif gas == 0 and brake == 0:
            tire.brake()
        if exitBtn():
            keyboardInterrupt()

finally:
    servo.default()
    time.sleep(0.2)
    GPIO.cleanup()
예제 #2
0
		if event.code == 0:
			if event.value >= 30000:
				speed = 2 * Trigger / 20
				return speed
			else:
				return Trigger
'''

servo.default()
x = 6.5
y = 7.5
z = 6

for event in gamepad.read_loop():
    if event.type == ecodes.EV_ABS:
        if event.code == RT:
            if event.value >= 0:
                if links:
                    tire.run(rechner(2), rechner(20))
                elif rechts:
                    tire.run(rechner(20), rechner(2))
                else:
                    tire.run(TriggerBerechnung(), TriggerBerechnung())
            if event.code == LT:
                tire.back(Lsticks(), Rsticks())
        else:
            tire.brake()
    elif event.type == ecodes.EV_KEY:
        if event.value == 1:
            if event.code == guide:
                KeyboardInterrupt()
예제 #3
0
import RPi.GPIO as GPIO
import tire
import LED
import time



try:
    while True:
        LED.red()
        tire.run(7)
        LED.green()
        tire.run_left(2)
        LED.blue()
        tire.run_right(2)
        LED.turkis()
        tire.run(6.5)
        LED.red()
        tire.spin_left(0.55)
        LED.blue()
        tire.run(8)
        for i in range(5):
            tire.spin_left(1)
            LED.red()
            tire.spin_right(1)
            LED.blue()
        GPIO.cleanup()
except KeyboardInterrupt:
    pass
예제 #4
0
# WASD - Servo-Kamera
# NM - Servo-Ultraschallsensor/LED
# P - Servo default
# O - SOS
# 7 - Fan-stop
# 8 - Fan-run-slow
# 9 - Fan-run

servo.default()
x = 6.5
y = 7.5
z = 6

while True:
	if ir.getBinary() == 1000001110:
		tire.run()
	elif ir.getBinary() == 10000011010:
		tire.back()
	elif ir.getBinary() == 100001111:
		tire.left()
	elif ir.getBinary() == 10000010011:
		tire.stop()

try:
	while True:
		char = screen.getch()
		if char == curses.KEY_UP:
			tire.run()
		elif char == curses.KEY_LEFT:
			tire.run_left()
		elif char == curses.KEY_RIGHT:
예제 #5
0
import RPi.GPIO as GPIO
import tire
import LED
import ultrasonic
import time

try:
	LED.blue()
	tire.run(7)
	LED.turkis()
	tire.run_left(2)
	tire.run_right(2)
	LED.blue()
	tire.run(6.5)
	LED.turkis()
	tire.spin_left(0.55)
	LED.blue()
	tire.run(5.6)
	LED.turkis()
	tire.spin_left(0.7)
	while True:
		print('Abstand', ultrasonic.distanz())
		if ultrasonic.distanz() > 30:
			LED.blue()
			tire.run()
		else:
			tire.brake()
			while ultrasonic.distanz() < 30:
				LED.red(0.5)
				LED.off(0.5)
				if ultrasonic.distanz() < 30: