Вы находитесь на странице: 1из 16

RCX Workshop Day 2

Programming with
• Touch Sensor
• Light Sensor

Repeat

CJ Chung
Associate Professor of Computer Science
Lawrence Technological University
Start-Touch

 Wait until the touch sensor is pressed;


 Then start the robot to go forward
 Stop after a second
Start-Touch
Start-Bright

 Wait until the light sensor detects very


bright light
 Then start the robot to go forward
 Stop after a second
Start-Bright
Stop-Touch

 Go straight until the bumper is hit


 then stop
Stop-Touch
Go Till Edge

 Go straight until the white edge of the


ring
 Then stop
Go Till Edge
Loop

 To repeat a sequence of code


blocks
 Until
 Number of repetitions
 Forever

 Elapsed time
 Sensor condition is met

 Logic becomes true


To play A note three times
Make the robot move around in the
ring – Basic Sumo (Sumo0)

 Repeat the following forever:


 Go forward until the edge
 Backward slightly

 Turn right
Make the robot move around in the
ring – Basic Sumo (Sumo0)

 Repeat the following forever:


 Go forward until the edge
 Backward slightly (in Big block)

 Turn right
First Sumo Competition
Additional Mission, if time available

 Unknown start – Let the robot wait 5


seconds when the game starts
Additional Mission, if time available

 Touch the wall


 Go back slightly
 Turn (spin) right
Wall
 Stop at the target;

Start

Вам также может понравиться