From 8f1e3cb989a007cae8ebcba0c8bcc6637a7a3b39 Mon Sep 17 00:00:00 2001 From: Andrey Pohilko Date: Mon, 16 Jul 2018 10:32:35 +0300 Subject: [PATCH] Harmonograph demo --- examples/harmonograph/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 examples/harmonograph/__init__.py diff --git a/examples/harmonograph/__init__.py b/examples/harmonograph/__init__.py new file mode 100644 index 0000000..c08a73f --- /dev/null +++ b/examples/harmonograph/__init__.py @@ -0,0 +1,26 @@ +import logging +import traceback + +import time + +from pylgbst import MoveHub +from pylgbst.comms import DebugServerConnection, BLEConnection + +if __name__ == '__main__': + logging.basicConfig(level=logging.INFO) + + try: + conn = DebugServerConnection() + except BaseException: + logging.warning("Failed to use debug server: %s", traceback.format_exc()) + conn = BLEConnection().connect() + + hub = MoveHub(conn) + try: + hub.motor_AB.constant(0.45, 0.45) + hub.motor_external.angled(12590, 0.1) + #time.sleep(180) + finally: + hub.motor_AB.stop() + if hub.motor_external: + hub.motor_external.stop()