

How to use the Color Sensor event block in LEGO SPIKE Prime Word Blocks software
Here's one way to program using a color sensor!
- #2313
- 30 Jul 2024
There are common patterns when working with LEGO Mindstorms Sensors that could be applied to Sound, Rotation, Gyro, Color and all the other sensors.
LEGO Mindstorms EV3 and NXT include many sensors. Use of the sensors is what makes the robot powerfull.
Here's one way to program using a color sensor!
What is a color? How does our robot detect it? Learn that here!
Have you ever wondered if your robot can make decisions? Here's how we can make that happen!
Have you ever wondered if your robot can make decisions? Here's how we can achieve that!
This is one of the first sensor blocks you'll learn! Here's how we use it!
Now that you know how the distance sensor works, how do we use it?
How does the distance sensor measure distance? Let's learn!
Have you ever needed your robot to do two things at once? That's called a parallel thread. Here's how to do it in SPIKE Prime using Word Blocks software.
In this video tutorial we accomplish the FIRST LEGO League 2022-2023 SUPER POWERED mission called M04 Solar Farm. We use the chain monster box robot along with a passive attachment that helps us collect 3 of the energy units. The interesting thing about the mission is the collection of the units, of course, but also the way this robot manoeuvres when there is not enough space. It aligns to the lines, it uses the color and motion sensors. Really advance way to align the robot.
This is a 10 out of 10 video tutorial where we demonstrate the consistency and reliability of a LEGO Education SPIKE Prime Active attachment connected to the motors of the robot. The goal of this attachment is to accomplish the Bridge mission where we have to push both parts of the bridge and bring them down to connect them. We use some line following.
In this video tutorial, we accomplish a FIRST LEGO League mission called The Bridge. We demonstrate how to use a really simple active attachment where the goal of the mission is to push down both parts of the bridge. We do not enter into the programming and we leave it up to you as an exercise.
In this 10 out of 10 tutorial, we accomplish the Platooning Trucks from FIRST LEGO League (FLL) 2021-2022. The goal of the mission is to connect the trucks to each other and both of them to the bridge. The attachment and the robot pushes the trucks and we do it 10 times to see the consistency and reliability of the robot.
In this video tutorial, we accomplish the FIRST LEGO League 2021-2022 mission called Platooning Trucks. The goal is to connect the two mission models (trucks) to each other and then connect them both to the bridge. It's quite an interesting mission as it involves three mission models.
This is a 10 out of 10 video tutorial demonstrating the consistency and reliability of a configurable attachment. The attachment is designed to accomplish the FIRST LEGO League 2021-2022 Cargo Connect mission model called Sorting Center. The mission model has 3 cargo objects that could be placed in a different way. The attachment is configurable and before the run we configure it for the specific way in which the mission model is set up before the start of the round.
In this video tutorial, we demonstrate a configurable attachment used for accomplishing a FIRST LEGO League 2021-2022 Cargo Connect mission called Sorting Center. The mission model has three cargo objects that are placed randomly. The attachment is configured before the run based on the configuration of the cargo objects. This attachment is also very powerful as it aligns and auto-corrects the errors that the robot is making by squaring the robot.
This is a recording of a completely perfect, 10 out of 10 accomplishment of a two-part mission - Train tracks, from the FIRST LEGO League 2021-2022 Cargo Connect competition. Due to the proper use of motion and color/light sensors, the robot is 100% consistent and reliable for a non-trivial mission. Even when the robot makes a mistake, it auto-corrects and compensates for this mistake.
This tutorial explains the use of motion and light/color sensors to accomplish a complex mission split into three parts. It gets into detail about how we keep a straight line with the motion sensor, follow a line with the color sensors, and transition between different parts of the program by aligning and detecting lines with the sensor. The goal is to get to a reliable and consistent behavior of the robot. On top of that, it is configurable, as we've left a few parameters that could be set to configure the behavior for a specific robot, venue, lighting, battery level, and wheels friction.
"Sometimes it works, sometimes it does not work" - this is the most common case in FIRST LEGO League competitions. In this tutorial, we demonstrate and discuss such a case where the first part of accomplishing the mission always works but the second part has about 60-70% success rate. The robot is not very consistent. Let's take a moment to see it and explain why so that we can resolve the problem in the next lesson.
In this video tutorial, we use the motion sensor and demonstrate 10 out of 10 times how we can keep the robot moving in a straight line. The program is described in the previous tutorial in the lesson where we enter into the programming. Here we visualize how consistent and reliable the behavior of the robot is.
In this video tutorial, we use the Unload Cargo Ship mission from FIRST LEGO League 2021 Cargo Connect robotics competition to demonstrate how we program the robot to keep a straight line while moving. Do we need that for this mission? Probably not, but we do it either way to demonstrate the solution in a fairly simple mission. The program uses the motion sensor to auto-correct the errors the robot is making while moving.
This is a 10 out of 10 tutorial for pushing gently on a mission model. We also discuss how to build robots that tolerate error and auto-correct their behavior.
In this video tutorial, we demonstrate how to gently push an object to accomplish the mission. "Gently" means that we are pushing but not with force. If we push using force, the mission model will fall, and we will not accomplish the mission. We use LEGO Education SPIKE Prime and the Ultrasonic Sensor.
With this first tutorial on the Motion Sensor in the LEGO MINDSTORMS Robot Inventor course we demonstrate the basic algorithm for moving in a straight line with the Motion Sensor. From here all the other algorithms are modifications, and if you know the basic it will be easier to tweak the behavior for your particular challenge
In this video tutorial, we push two of the mission models with a pinless active attachment with gears. The goal is to push the mission models after the blue lines. This attachment is interesting as it demonstrates a non-straightforward idea of how we can push the mission models. We explain the Scratch program and how we use the motion sensors - you will learn how to turn to a specific angle by using the motion sensor.
In this 10 out of 10 tutorials we do 10 runs that demonstrated how consistent and reliable it is to stop at the second intersection. This is useful as it is one of the main ways to figure out how to position yourself on the field.
In this video tutorial we take a next step in programming reliable and consistent robots and this is to learn how to stop at a second intersection. We need this because most of the time when we want to reach a mission model on a robotics competition field, the model will be located away from us and we must use all kind of technique to reach it. In this tutorial - we stop at a second intersection.
On of the most precise ways to position on the FIRST LEGO League and other competition fields is to follow and align and in this tutorial we demonstrate exactly this - how consistent and reliable this method is to reach specific mission models. In this way you know that every time you will be at the right place, which is great.