-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsteeringtest2.py
More file actions
41 lines (37 loc) · 777 Bytes
/
steeringtest2.py
File metadata and controls
41 lines (37 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import math
import py_qmc5883l
from time import sleep
from gps import *
import time
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(32, GPIO.OUT)
GPIO.setup(36, GPIO.OUT)
GPIO.setup(38, GPIO.OUT)
def goLeft():
print("LEFT")
GPIO.output(32, GPIO.HIGH)
GPIO.output(36, GPIO.LOW)
def goRight():
print("RIGHT")
GPIO.output(32, GPIO.LOW)
GPIO.output(36, GPIO.HIGH)
def goStraight():
print("STRAIGHT")
GPIO.output(32, GPIO.HIGH)
GPIO.output(36, GPIO.HIGH)
def goForwards():
GPIO.output(38, GPIO.LOW)
print("forwards")
def stop():
GPIO.output(38, GPIO.HIGH)
stop()
for x in range(0,50):
goRight()
time.sleep(0.5)
goStraight()
time.sleep(0.5)
goLeft()
time.sleep(0.5)
goStraight()