aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2022-02-18 16:44:06 -0600
committerMatt Strapp <matt@mattstrapp.net>2022-02-18 16:44:06 -0600
commita5f3c41ba73b6d09758ab59e11e0cff644575859 (patch)
tree5dcdbf0bcc170de1ff96990657c01c061f694c41
parentLint (diff)
downloadee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar.gz
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar.bz2
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar.lz
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar.xz
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.tar.zst
ee4511w-web-a5f3c41ba73b6d09758ab59e11e0cff644575859.zip
Add super basic example
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r--src/public/example.py51
1 files changed, 12 insertions, 39 deletions
diff --git a/src/public/example.py b/src/public/example.py
index 27f5835..7768ecf 100644
--- a/src/public/example.py
+++ b/src/public/example.py
@@ -1,42 +1,15 @@
-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
+# REQUIRED IMPORT! The pendulum will NOT WORK if you do not import this.
+from pendulum import System
-clk_pin = 3
-cs_pin = 23
-data_pin = 2
+# Initialize the system
+system = System()
-e = Encoder(clk_pin, cs_pin, data_pin)
-e.set_zero()
-sys = System(angular_units = 'Radians')
+# REQUiRED! This initializes the system.
+system.initialize()
-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()
+#
+# Add your code here!
+#
+
+#REQUIRED! This deinitializes the system, allowing another instance to be initialized.
+system.deinitialize() \ No newline at end of file