Many times we just upload blocks and leave it up to you to use it. In this tutorial, I would like to show you how to use the implemented blocks. How to import them into the EV3-G software. How to see them in the palette. How to drag and drop them to build a working program.
- 04 Oct 2017
- Mindstorms Competitions, Mindstorms Sensors, Light & Color Sensor, Programming
- D.Staykov, K.Mitov
The settings icon is in the upper left.
Go to Settings->Programs->Import.
Select the file with the blocks and click Open.
This will import three blocks in your program.
- InitArray -> for initializing the arrays
- CalibrateMinMax -> for finding the min and max values detected by each sensor
- GetCalibratedValue -> for returning the calibrated value based on min and max
Using the imported blocks
The blocks are available in the MyBlocks palette and you can directly use them.
This package contains the three blocks used in the advanced calibration section of the FLL course.
The blocks contained are:
- InitiArray block
As a part of this course section we've developed a few blocks and we've attached these blocks to the course section so you can just download them and in this tutorial I would like to show you how to use them, how to download, import these blocks and use them in your program so that you can have this advanced calibration for all the light sensors and the simple example is a program where you move for about a second, calibrate the sensors and then just stop on a black line but you can follow a line, you can align to a line or you can detect different colors on the field. So, let's see how to download and to use these already available blocks. I've created a new project and in this new project I'll open Settings Project Properties > My Blocks and click Import and I'll select the file that we've attached and this is the MyCalibrateSensors.ev3s and as I open it 3 new blocks will be added to our program. These are the InitArray, CalibrateMinMax and GetCalibratedValue. How do we use these blocks? You go to program and you have the blocks in this palette - MyBlocks palette. And first we'll init, then we can set a loop for about a second - like 1 second and in this 1 second we CalibrateMinMax, then we move
and in a loop we detect the value of sensor 2. And if this value is less than 50, we want this loop to stop. I'll start the robot - just move forward, detect a value, and if this value is
less than 80, then we stop the loop.
And then we stop the whole robot.
First, we InitArray and here we must start the robot so that it moves forward for about a second so let's just start the motors and we must set them to minus because our 2 motors are in a reverse direction then we must stop the robot.
Then we start it again in reverse with a power of -20 or -30 and we wait for the value of sensor 2 to be less than 80 as a calibrated value. So, as you can see it's pretty easy to use the three blocks - the InitArray, the CalibrateMinMax and the GetCalibratedValues. They very much look the same like all the other blocks like if you have a wait block for a color sensor,
what you should do is specify the port and again here you specify the port. So, we've tried to keep this approach very similar to the current blocks and it is very easy to use these blocks. And it's a more advanced calibration but you are not dependent on changing the different ports, you're not dependent on different calibration that's inside of the EV3. You are doing the calibration yourself, in the first one second of the run and then you use only these calibrated values that are dynamically calculated. So, try to use them. If you have any problems, leave us a comment below and we'll try to resolve this and during a competition try to also use them and keep in mind that this is something that will help you to use more than 1 sensor for sure but even for 1 sensor it will do a pretty good job.