RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of...

16
RCX Workshop Day 2 Programming with • Touch Sensor • Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University

Transcript of RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of...

Page 1: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

RCX Workshop Day 2

Programming with • Touch Sensor • Light Sensor

Repeat

CJ ChungAssociate Professor of Computer ScienceLawrence Technological University

Page 2: 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

Page 3: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Start-Touch

Page 4: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Start-Bright

Wait until the light sensor detects very bright light

Then start the robot to go forward Stop after a second

Page 5: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Start-Bright

Page 6: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Stop-Touch

Go straight until the bumper is hit then stop

Page 7: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Stop-Touch

Page 8: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Go Till Edge

Go straight until the white edge of the ring

Then stop

Page 9: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Go Till Edge

Page 10: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Loop

To repeat a sequence of code blocks

Until Number of repetitions Forever

Elapsed time Sensor condition is met Logic becomes true

Page 11: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

To play A note three times

Page 12: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

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

Repeat the following forever: Go forward until the edge Backward slightly Turn right

Page 13: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

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

Page 14: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

First Sumo Competition

Page 15: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Additional Mission, if time available

Unknown start – Let the robot wait 5 seconds when the game starts

Page 16: RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.

Additional Mission, if time available

Touch the wall Go back slightly Turn (spin) right Stop at the target;

Wall

Start