From 1e5d42ba53ea0c631dbc6f21887839c91571ebca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Tue, 13 Oct 2015 12:24:41 +0200 Subject: Uvodne vaje za robotiko --- robot/problems/introduction/inline.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 robot/problems/introduction/inline.py (limited to 'robot/problems/introduction/inline.py') diff --git a/robot/problems/introduction/inline.py b/robot/problems/introduction/inline.py new file mode 100644 index 0000000..67a6f06 --- /dev/null +++ b/robot/problems/introduction/inline.py @@ -0,0 +1,19 @@ +solution = '''\ +from ev3dev import * +from mindstorms_widgets import mindstorms_widgets + +robot = mindstorms_widgets() +robot.connect_motor( 'left' ) +robot.connect_motor( 'right' ) +robot.connect_sensor( 'ultrasonic' ) +robot.move_steering( 'on', power=80 ) +while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 500: + pass +robot.move_steering( 'on', power=20 ) +while robot.ultrasonic_sensor_measure( 'distance-cm' ) > 200: + pass +robot.move_steering( 'off' ) +''' + +print (any(('power' in s and '80' in s and '=' in s) for s in solution.split('\n'))) + -- cgit v1.2.1