-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest5.py
More file actions
70 lines (38 loc) · 869 Bytes
/
test5.py
File metadata and controls
70 lines (38 loc) · 869 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
#GPIO.setup(16, GPIO.OUT)
#steer = GPIO.PWM(16, 50)
GPIO.setup(26, GPIO.OUT)
motor = GPIO.PWM(26, 50)
motor.start(100)
try:
while True:
#0.47 full stop
#steer.start(50)
i = raw_input('> ')
#p=(float(i)*100.0)/3.3
#while True:
#if type(D) == float:
# if D <= 100:
# break
#print p
motor.ChangeDutyCycle(float(i))
motor.ChangeFrequency(float(100))
#steer.ChangeDutyCycle(float(i))
#steer.ChangeFrequency(float(100))
# time.sleep(30)
#motor.stop()
#steer.stop()
except KeyboardInterrupt:
pass
#motor.stop()
#steer.stop()
GPIO.cleanup()
#p.start(50)
#p.ChangeDutyCycle(90)
#p.ChangeFrequency(100)
#p.stop()
class motorDriver(object):
def __init__(self):
pass