aboutsummaryrefslogtreecommitdiffstats
path: root/System_Python/test_Motor.py
diff options
context:
space:
mode:
authorRaspberry Pi <pi@umn.edu>2019-09-24 16:57:14 -0500
committerRaspberry Pi <pi@umn.edu>2019-09-24 16:57:14 -0500
commit1e298b701fbc1c1048122efc5181fb37eeba2829 (patch)
treec523f9a6a4cf044846fa2d4a721f9346c0106950 /System_Python/test_Motor.py
parentAdd motor test file. Add __init__.py to allow library imports. (diff)
downloadee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar.gz
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar.bz2
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar.lz
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar.xz
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.tar.zst
ee4511w-1e298b701fbc1c1048122efc5181fb37eeba2829.zip
Tested on RPi and minor changes to make it work.
Diffstat (limited to 'System_Python/test_Motor.py')
-rw-r--r--System_Python/test_Motor.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/System_Python/test_Motor.py b/System_Python/test_Motor.py
index f14af59..600f209 100644
--- a/System_Python/test_Motor.py
+++ b/System_Python/test_Motor.py
@@ -2,22 +2,22 @@ from motor import Motor
import time
# Decide which pins to hook up to on the Pi before running
-speed_pin = 15
-forward_pin = 16
-reverse_pin = 17
+speed_pin = 17
+forward_pin = 27
+reverse_pin = 22
m = Motor(speed_pin, forward_pin, reverse_pin)
dir = 'ascending'
speed = 0.0
while 1:
- m.Move(speed)
- if speed >= 100.0:
- dir = 'descending'
- elif speed <= -100.0:
- dir = 'ascending'
- if dir == 'ascending':
- speed = speed + 0.5
- else:
- speed = speed - 0.5
- time.sleep(0.1) \ No newline at end of file
+ m.Move(speed)
+ if speed >= 100.0:
+ dir = 'descending'
+ elif speed <= -100.0:
+ dir = 'ascending'
+ if dir == 'ascending':
+ speed = speed + 0.5
+ else:
+ speed = speed - 0.5
+ time.sleep(0.1) \ No newline at end of file