From f80206e6a4e4cec1574a375cb04dbdf07d3e02cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=BDabkar?= Date: Wed, 23 Dec 2015 11:28:05 +0100 Subject: angleska verzija --- robot/problems/introduction/countlines/en.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'robot/problems/introduction/countlines/en.py') diff --git a/robot/problems/introduction/countlines/en.py b/robot/problems/introduction/countlines/en.py index 8b3b275..009a752 100644 --- a/robot/problems/introduction/countlines/en.py +++ b/robot/problems/introduction/countlines/en.py @@ -7,8 +7,31 @@ name = 'Count lines' slug = 'Count lines' description = '''\ + Write a program to count the color lines on white background using the robot with a color sensor. The robot should drive forward, crossing the lines and count them. ''' hint = { - + 'mW_init':mod.hint['init'], + 'connectMotorLeft':mod.hint['connectMotorLeft'], + 'connectMotorRight':mod.hint['connectMotorRight'], + 'moveSteeringOn':mod.hint['moveSteering']+['''

Use move_steering method with 'on' as the first parameter robot.move_steering( 'on',... ).

'''], + 'moveSteeringOff':mod.hint['moveSteeringOff'], + 'connectColorSensor':mod.hint['connectColorSensor'], + 'colorSensorMeasure':mod.hint['colorSensorMeasure'], + 'while':['''

Use the while loop: inside, the robot should read the current color and increase the counter when the color changes.

''', + '''

Interrupt the loop after a certain amount of time; determine the time the robot needs to drive over all the colors experimentally; use time.time().

''', + '''

while time.time()-start < 1.5:.

'''], } + +plan = ['''\ +

The program should:

+
    +
  1. create a mindstorms_widgets() object, which represents the robot in your code.
  2. +
  3. connect the driving motors.
  4. +
  5. connect the color sensor.
  6. +
  7. synchronize the motors and run them so that the robot would move forward.
  8. +
  9. inside the loop, let the robot recognize colors and increase the counter.
  10. +
  11. interrupt the loop after a certain amount of time.
  12. +
  13. stop the motors.
  14. +
''' +] -- cgit v1.2.1