lehrkraefte:blc:informatik:glf20:robotik:mgr:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
lehrkraefte:blc:informatik:glf20:robotik:mgr:start [2021/03/26 11:59]
michael.greminger
lehrkraefte:blc:informatik:glf20:robotik:mgr:start [2021/03/26 12:09] (current)
michael.greminger
Line 94: Line 94:
 <hidden Lösungsvorschlag> <hidden Lösungsvorschlag>
 <code python> <code python>
-kommt bald...+from simrobot import * 
 +from random import randrange 
 +RobotContext.useBackground("sprites/border.gif"
 +RobotContext.setStartPosition(350 + randrange(50), 250) 
 +RobotContext.setStartDirection(135+randrange(90)) 
 +   
 +robot = LegoRobot() 
 +gear = Gear() 
 +robot.addPart(gear) 
 +ls = LightSensor(SensorPort.S3) 
 +robot.addPart(ls) 
 +ls.activate(True) 
 +gear.forward() 
 + 
 +while not robot.isEscapeHit(): 
 +   v = ls.getValue() 
 +   if v > 500: 
 +      break 
 +   Tools.delay(100)      
 +robot.exit()
 </code>   </code>  
 </hidden> </hidden>
  • lehrkraefte/blc/informatik/glf20/robotik/mgr/start.1616756355.txt.gz
  • Last modified: 2021/03/26 11:59
  • by michael.greminger