From 1337de59b712c30c447b2b45de9ec54ecd6d8ea4 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Fri, 18 Feb 2022 12:41:51 -0600 Subject: Hopefully get the system able to be packaged Signed-off-by: Matt Strapp --- System/Tests/test_Motor.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 System/Tests/test_Motor.py (limited to 'System/Tests/test_Motor.py') diff --git a/System/Tests/test_Motor.py b/System/Tests/test_Motor.py new file mode 100644 index 0000000..f48b6ee --- /dev/null +++ b/System/Tests/test_Motor.py @@ -0,0 +1,29 @@ +from motor import Motor +import time +import RPi.GPIO as GPIO + +# Decide which pins to hook up to on the Pi before running +speed_pin = 17 +forward_pin = 27 +reverse_pin = 22 + +m = Motor(speed_pin, forward_pin, reverse_pin) + +dir = 'ascending' +speed = 0.0 +try: + while 1: + if speed >= 15.0: + dir = 'descending' + elif speed <= -15.0: + dir = 'ascending' + if dir == 'ascending': + speed = speed + 2.0 + else: + speed = speed - 2.0 + m.move(speed) + time.sleep(0.1) +except: + print("Program killed by Ctrl-C") +finally: + GPIO.cleanup() \ No newline at end of file -- cgit v1.2.3