aboutsummaryrefslogtreecommitdiffstats
path: root/System
diff options
context:
space:
mode:
authordamic014 <damic014@umn.edu>2019-09-24 14:43:38 -0500
committerdamic014 <damic014@umn.edu>2019-09-24 14:43:38 -0500
commit62bd607b498a6f6b8aff091ac2c46bc77cbe8359 (patch)
tree0e63fe1fb75364d9afcef8f6d8e69e7a505468a8 /System
parentAdded Motor class (diff)
downloadee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar.gz
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar.bz2
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar.lz
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar.xz
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.tar.zst
ee4511w-62bd607b498a6f6b8aff091ac2c46bc77cbe8359.zip
Add motor test file. Add __init__.py to allow library imports.
Diffstat (limited to '')
-rw-r--r--System_Python/__init__.py0
-rw-r--r--System_Python/test_Motor.py23
2 files changed, 23 insertions, 0 deletions
diff --git a/System_Python/__init__.py b/System_Python/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/System_Python/__init__.py
diff --git a/System_Python/test_Motor.py b/System_Python/test_Motor.py
new file mode 100644
index 0000000..f14af59
--- /dev/null
+++ b/System_Python/test_Motor.py
@@ -0,0 +1,23 @@
+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
+
+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