How to accurately reach a mission model with basic use of Motion Sensor from LEGO Education SPIKE Prime ProPreview

In this video tutorial we use the LEGO Education SPIKE Prime Motion Sensor to reach a mission model on the field. It's a basic use of the motion sensor that we will extend in the next few tutorials and in the same time we take the opportunity to demonstrate what a MyBlock is and how to develop one. As a result of this video you will learn how to make the program easier to read and maintain by organizing the blocks in the program in special MyBlocks that couple them all together.

• #1929
• 28 Jun 2022
• 8:42

My Blocks is a concept that you will see throughout the course and also it is the concept of Functions and Procedures in programming languages. MyBlocks could accept parameters, which we as engineers that are quite lazy, often call "params". That that jargon. That's the language. In the tutorial we build a MyBlock that accepts two params.

How to use this tutorial

Download the program to the robot. Experiment with running another sequence of "Move Towards" my blocks. Check how the robot will behave. Try to reach a few new mission models with every run.

English

In this video tutorial. We use LEGO Education SPIKE Prime and we reach a mission model. A mission model that's on the other side of the field. So we have to do a couple of turns to get there. We use the motion sensor and again we use a basic program for the motion sensor, but we've made it a little bit more advanced with my block. Let's see how the program behaves and what's our end goal. We move with the robot. We follow a straight line. Now it doesn't look like it's a straight line because the robot is moving left right, left right, left right. But that's the basic algorithm for keeping a straight line with the robot. And we've reached the mission model. Let's now run it one more time and then we'll enter into programming.

One more time. Starting from the base, the robot moves, turns left, keeps a straight line, turns right, keeps a straight line, moves forward almost the length of the field, then turns and it reaches a mission model. That's our goal. That's our goal with this Lego Education SPIKE Prime. On this FIRST LEGO League, how consistent is this? One more time. It's much more consistent than not using sensors, but of course this is a basic program. This is the next step. We can now improve this with more and more. It is important how you start the robot and the angle that it is facing because this angle is important for the motion sensor. But at the end we reach the mission model. Let's stop here, enter into the programming and see how we develop the Scratch program for this.

Here is the program. It's a Scratch program that we've developed for this LEGO Education SPIKE Prime. And let me zoom in a little. We've introduced a new concept with this program and that's the MyBlock you can see the program. And on the right the recording. So let's move through the program. And see what our idea was when the program starts we set movement to motors A and B and we set speeds to 50%. It's our general best practice. We reset the yaw angle. It's always a good idea when you start from the base reset the angle then the program looks like this: move towards