diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-02-14 15:39:22 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-02-14 15:39:22 -0600 |
commit | 150c06a1171be1ad965afc37beeec9863818b508 (patch) | |
tree | fbcb8dafdb12df640c10625f73639d43feba4e5a /src/public/example.py | |
parent | Bump eslint from 8.8.0 to 8.9.0 (#6) (diff) | |
download | ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar.gz ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar.bz2 ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar.lz ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar.xz ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.tar.zst ee4511w-web-150c06a1171be1ad965afc37beeec9863818b508.zip |
maybe achieve feature parity
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/public/example.py')
-rw-r--r-- | src/public/example.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/public/example.py b/src/public/example.py new file mode 100644 index 0000000..27f5835 --- /dev/null +++ b/src/public/example.py @@ -0,0 +1,42 @@ +import sys +sys.path.insert(0, '/home/pi/pendulum/System') +from System.system import System +import time +from sys import exit +sys.path.insert(0, '/home/pi/pendulum/System') +from encoder import Encoder +import RPi.GPIO as GPIO + +clk_pin = 3 +cs_pin = 23 +data_pin = 2 + +e = Encoder(clk_pin, cs_pin, data_pin) +e.set_zero() +sys = System(angular_units = 'Radians') + +for x in range(4,20): + linear = 0 + + print("beginning of test with speed " + str(x)) + + while linear > -7: + sys.adjust(-5) + angle, linear = sys.measure() + print("Angle: " + str(angle) + ", Linear: " + str(linear)) + time.sleep(0.1) + sys.adjust(0) + time.sleep(3) + sys.add_log("this is a test with speed " + str(x)) + + while linear < 7: + sys.adjust(x) + angle, linear = sys.measure() + print("Angle: " + str(angle) + ", Linear: " + str(linear)) + sys.add_results(e.read_position('Degrees'), linear, x) + time.sleep(0.1) + sys.adjust(0) + print("end of test with speed " + str(x)) + time.sleep(3) +deinitialize() +exit() |