Created
January 24, 2017 09:58
-
-
Save samister2k/90c5d430b5785bee58bc8e4168a3b8a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
import RPi.GPIO as GPIO | |
from time import sleep | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(23, GPIO.OUT). | |
GPIO.setup(24, GPIO.OUT). | |
GPIO.setup(17, GPIO.OUT). | |
GPIO.setup(27, GPIO.OUT). | |
print("Welcome to the best rover ever!!") | |
sleep(3) | |
control=input("Press W to move Forward or D to turn Right or A to turn Left and S to move Backwards!") | |
if control=="W": | |
GPIO.output(17, GPIO.HIGH) | |
GPIO.output(24, GPIO.HIGH) | |
sleep(10) | |
GPIO.output(17, GPIO.LOW) | |
GPIO.output(24, GPIO.LOW) | |
elif control=="A": | |
GPIO.output(17, GPIO.HIGH) | |
sleep(5) | |
GPIO.output(17, GPIO.LOW) | |
elif control=="D": | |
GPIO.output(24, GPIO.HIGH) | |
sleep(5) | |
GPIO.output(24, GPIO.LOW) | |
elif control=="S": | |
GPIO.output(27, GPIO.HIGH) | |
GPIO.output(23, GPIO.HIGH) | |
sleep(10) | |
GPIO.output(27, GPIO.LOW) | |
GPIO.output(23, GPIO.LOW) | |
else: | |
print("THIS IS NOT A CONTROL") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment