Here's one way to program using a color sensor!

To access the full video please subscribe to FLLCasts.com
- #2313
- 30 Jul 2024
The block is located in the Events section. This means it serves as the starting point of the program, so no blocks can be placed before it.
By default, this block triggers the blocks that follow it when the sensor detects red. This means that the program will not start until the color sensor detects the specified color.
The first setting is the port, where you must select the port to which your sensor is connected. By default, this is port A.
The second setting allows you to change the color that activates the block. You can choose between 8 colors and a no-color option!
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Level B2 - Introduction to Robotics Competitions - Robotics with LEGO SPIKE Prime
This is the fourth level of the LEGO Robotics Curriculum for students in second, third, or fourth grades.
Competitive Introduction Level: Each lesson has a theme related to various LEGO robotics competitions. Students learn about FIRST LEGO League, Line Following, and Sumo Wrestling. A new color sensor is introduced, and students use forever loops, wait until commands, and if/else statements in new ways.
- 21
- 1:03
- 60

Lesson 1 - Color Sensor
Introduction
In this level, we will learn how to use a new sensor - the COLOR SENSOR! We will also explore various robotics competition disciplines, such as FLL, Line Following, and Sumo!
Have you heard of any of these competitions? Would you like to participate in any of them?
We will start with the namesake of this site - FLL. FLL stands for FIRST LEGO League. An FLL competition has four categories: Research Project, Core Values, Robot Design, and Robot Game.
We will focus on the Robot Game, which takes place on a special field, like the one in the picture. The field has multiple missions that the robot should accomplish to score points. The robot that scores the most points in 2 minutes and 30 seconds wins.
Every year, FLL has a new theme, which changes the entire Robot Game Field. Teams have a few months to prepare their robot before the actual competition begin.
- 6
- 4
- 11
- 3d_rotation 2