mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
Enable full demo
This commit is contained in:
parent
afe5c3a55a
commit
5317dedccd
8
demo.py
8
demo.py
@ -10,9 +10,9 @@ log = logging.getLogger("demo")
|
|||||||
|
|
||||||
def demo_all(conn):
|
def demo_all(conn):
|
||||||
movehub = MoveHub(conn)
|
movehub = MoveHub(conn)
|
||||||
# demo_led_colors(movehub)
|
demo_led_colors(movehub)
|
||||||
# demo_motors_timed(movehub)
|
demo_motors_timed(movehub)
|
||||||
# demo_motors_angled(movehub)
|
demo_motors_angled(movehub)
|
||||||
demo_port_c_motor(movehub)
|
demo_port_c_motor(movehub)
|
||||||
|
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ def demo_motors_angled(movehub):
|
|||||||
movehub.motor_AB.angled(360, 1, -1)
|
movehub.motor_AB.angled(360, 1, -1)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
movehub.motor_AB.angled(360, -1, 1)
|
movehub.motor_AB.angled(360, -1, 1)
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def demo_port_c_motor(movehub):
|
def demo_port_c_motor(movehub):
|
||||||
@ -56,6 +57,7 @@ def demo_port_c_motor(movehub):
|
|||||||
portd.angled(90, 1)
|
portd.angled(90, 1)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
portd.angled(90, -1)
|
portd.angled(90, -1)
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -85,7 +85,7 @@ class EncodedMotor(Peripheral):
|
|||||||
|
|
||||||
command += self.TRAILER
|
command += self.TRAILER
|
||||||
|
|
||||||
self.parent.connection.write(MOVE_HUB_HARDWARE_HANDLE, chr(len(command)) + self.PACKET_VER + command)
|
self.parent.connection.write(MOVE_HUB_HARDWARE_HANDLE, chr(len(command) + 1) + self.PACKET_VER + command)
|
||||||
|
|
||||||
def timed(self, seconds, speed_primary=1, speed_secondary=None, async=False):
|
def timed(self, seconds, speed_primary=1, speed_secondary=None, async=False):
|
||||||
if speed_secondary is None:
|
if speed_secondary is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user