SENSING - REFLECTED LIGHT
Drag a Wait block to the program. We want to wait for Color Sensor, not Time, so click on the lower left button, called the Mode selector, of the block. This opens up choices – select Color Sensor > Compare > Reflected Light Intensity.
By default, the block setting will test this condition: Is the reflected light reading less than 50? The answer is either true (yes) or false (no).
Drag another Move Tank block to the end of the program, and set it to Off.
Download. Put your robot down on something light coloured ( white or yellow ). Point your robot towards something dark, like a black stripe. Run.
Download. Put your robot down on something light coloured ( white or yellow ). Point your robot towards something dark, like a black stripe. Run.
Does it stop when it reaches the dark colour?
What happens if you start it on the dark colour?
What happens if you take the last Move Tank block (Off) away?
What happens if you start it on the dark colour?
What happens if you take the last Move Tank block (Off) away?
The Color Sensor is sending a light out and measuring how much light is reflected back. Different colours will reflect different amounts of light.
Other things will also change the reading. If the sun comes out, a light in the room is turned on or somebody makes a shadow, the reading will change.
It is useful to know what readings your Color Sensor makes in your current environment:
Other things will also change the reading. If the sun comes out, a light in the room is turned on or somebody makes a shadow, the reading will change.
It is useful to know what readings your Color Sensor makes in your current environment:
READING THE LIGHT LEVEL ON THE EV3 USING PORT VIEW
Use the right button to get Port View showing on the robot's screen. Press Dark Grey to select Port View.
The default is Port 1. Find Port 3 by pressing the right button 2 times. It should be displaying
3:COL-REFLECT and some pct (percentage) underneath.
This is the Color Sensor reading. It can read from 0 to 100.
Put your robot's Color Sensor over the black line and write down the reading.
Put your robot's Color Sensor over the white background and write down the reading.
It is important to know these numbers so that you can make good choices about the numbers to use in your program.
Set the Wait – Color Sensor block so it moves on dark colours and stops when it reaches something light coloured. Test your program.
3:COL-REFLECT and some pct (percentage) underneath.
This is the Color Sensor reading. It can read from 0 to 100.
Put your robot's Color Sensor over the black line and write down the reading.
Put your robot's Color Sensor over the white background and write down the reading.
It is important to know these numbers so that you can make good choices about the numbers to use in your program.
Set the Wait – Color Sensor block so it moves on dark colours and stops when it reaches something light coloured. Test your program.
TIGER ROBOT CHALLENGE
Write a program to keep your tiger robot pacing in its cage. Make your robot move in a straight line across its square black tiger cage. It turns when it meets the edge of its cage then keeps on in a straight line until it meets another edge. Repeat this for ever.
You will need to use a loop, but this time set it to Unlimited rather than a Count.
If you are keen, see if you can contain your tiger better by having it back away from the edge before it turns.
You will need to use a loop, but this time set it to Unlimited rather than a Count.
If you are keen, see if you can contain your tiger better by having it back away from the edge before it turns.
ULTRASONIC SENSOR
The 'eyes' on your robot can detect objects as far as two and a half metres away. It uses an ultrasonic sensor, like a bat or a radar. A signal is sent out, and if an object is in front, the signal bounces back. The time taken for the signal to come back is a measure of the distance between the object and the robot.
Start a new program. Drag a Move Tank block to the Start position and set it to On. Drag a Wait for Time block to your program. Change its setting to Ultrasonic Sensor > Compare > Distance Centimeters. Make sure the port number matches the port your sensor is connected to. The default for the Ultrasonic Sensor is port 4. |
If you are using the Home Mindstorms software rather than the Education version you will need to download the Ultrasonic block. One place to get it from is http://www.lego.com/en-us/mindstorms/downloads
EV3 Software Block Download (PC/MAC)
Ultrasonic Sensor Block
Once you have downloaded the block file, return to the EV3 software. From the Tools menu choose Block Import.
Browse to find your downloaded file (Ultrasonic.ev3b).
Close and reopen the application in order to see the new block's effect.
EV3 Software Block Download (PC/MAC)
Ultrasonic Sensor Block
Once you have downloaded the block file, return to the EV3 software. From the Tools menu choose Block Import.
Browse to find your downloaded file (Ultrasonic.ev3b).
Close and reopen the application in order to see the new block's effect.
Set it to Distance < 30 cm.
Drag another Move Tank block and set it to Off. Download, point your robot towards a wall, and run.
You will have to be careful not to let the robot 'see' your hands when you press the run button. The robot may also see its own cables if they are in front of its 'eyes'.
Measure how far away your robot stops from the object it has detected.
Where should you measure from on the robot? Large sized objects with hard surfaces return the best readings. Objects made of soft fabric or that are curved [like a ball] or are very thin or small can be difficult for the sensor to detect.
Two or more Ultrasonic Sensors operating in the same room may interrupt each other’s readings.
Source: http://mindstorms.lego.com/overview/Ultrasonic_Sensor.aspx
You will have to be careful not to let the robot 'see' your hands when you press the run button. The robot may also see its own cables if they are in front of its 'eyes'.
Measure how far away your robot stops from the object it has detected.
Where should you measure from on the robot? Large sized objects with hard surfaces return the best readings. Objects made of soft fabric or that are curved [like a ball] or are very thin or small can be difficult for the sensor to detect.
Two or more Ultrasonic Sensors operating in the same room may interrupt each other’s readings.
Source: http://mindstorms.lego.com/overview/Ultrasonic_Sensor.aspx