Topics Covered
Lesson Links
Deleting Variable
If you create a Variable you don't need, you can delete it by clicking on the Wrench tab ().Once you click the Wrench tab (),
Project Property will open.
On the bottom, it will list all elements that resides in your project such as
Programs, Sounds, and Variables.
To delete Variables, open the Variable tab.
Select the Variable you would like to delete (in the image below, "CaveDarkness" is selected),
and press the 'Delete' button to remove them out of the project.
Did you notice?
Data Types
You may have noticed that Variables have three different Types. This is because the EV3 recognizes three distinct types of values: |
|
Numeric values |
Example:Ultrasonic Sensor Value (number between 0 and 255)
|
Text values |
Example:The text "MINDSTORMS" that the Display Block displays by default.
|
Logic values |
Example:Answer to the question "Is the Touch Sensor being pressed right now?" (Yes or No) |
You can recognize the type of data that a connector or wire holds by its shape and color: |
|
Some Blocks will not accept Data Types that don't make sense. For instance, you cannot use a Math Block to add two Text Values together ("Dog" + "Pig" doesn't make sense). |
Mini Challenge: Find the Black Line's Distance
Program your robot to find the first black line on the floor of the cave,
and report its distance from the entrance in Motor Rotations.
Modify your Color Sensor attachment so it can detect a black line on the floor of the box.
What value do you need to record once you have found the line? Hint: It's not the Color Sensor value.
Program your robot to:
- Drive into the box until it locates the black line on the ground
- Recrod the Rotation Sensor value at that time (into a Variable)
- Return to the entrance
- Display the motor rotations value you recorded earlier on the screen
Very Long Wires
In the EV3 Programming Language, you can use a very long wireYou can do this in most programs, but it creates messy programs that can become difficult to read. Use variables to avoid making a mess! |