Skip to main content

Castle Crasher
Lesson 4: Creating Algorithms

Introduction

In this Lesson, you will learn about the Optical Sensor, and how you can use sensor feedback to optimize your strategy and your code for playing Castle Crasher. You will also learn how to create an algorithm to code your robot to autonomously find Buckyballs and complete the Sweep the Field challenge.

Add an Optical Sensor

In this Lesson, you learn about the Optical Sensor, and explore how to use it with the Distance Sensor to create an algorithm.

Add the Optical and Distance Sensors to your BaseBot as shown in this image.

  • Add a 1x2x1x16 C-Channel to the front of the BaseBot as shown. 
  • Then, mount the Distance Sensor to the C-Channel facing out, as shown in the image.
  • Add the Optical Sensor pointing down.
  • The Distance Sensor should be plugged into Port 5, and the Optical Sensor into Port 1.

EXP Basebot with C-Channel, Distance, and Optical Sensors added with a callout showing that the optical sensor is pointing down, and the distance sensor is facing forward.


Select < Return to Lessons to return to the Lesson Overview.

Select Next > to learn about the Optical Sensor and how you can use sensor feedback and algorithms to code your robot to find and push Buckyballs off a Field.