Variables and constants are useful for storing data that you will need to access at different parts of your program. You can store a measured or calculated value as a variable that can be used later in your program as an input or as a part of another calculation. This can make your robot more dynamic and smarter.
- [Voiceover] There will be times when…you need to store the value from the sensor…and compare it with a later reading.…To demonstrate that I have the 06 02 Var Start open…with the move steering block and a medium motor block.…I've also replaced the IR sensor on the tracker robot…with the color sensor pointing downwards.…I want this program to make my robot move forward,…stop, and hit the tire on the map with the spinning arm.…
However, I don't know how many rotations…my large motor should make to make my robot…get in the right place to hit the tire.…I could use trial and error,…pick a number of rotations, run the program,…see how far my robot goes,…update the number of rotations accordingly,…test it again.…Update the number yet again, test it again.…
I would repeat this process over and over…until I get the desired behavior.…While the trial and error method works,…it can be time consuming to find…just the right number of rotations…to get my robot to where it needs to be.…I want my robot to be smarter than that.…
Learn how to unpack the hardware, connect to the programming interface, run prebuilt programs, and control the motors and sensors. Chapter 6, "Adding Flow to a Program," covers advanced programming topics such as transferring data between blocks, using variables to store temporary data, programming conditional logic, and looping actions to run again and again. By the end of the course, you'll have the skills to bring your own robotic creations to life.
- Installing the LEGO Mindstorms software
- Exploring the programming interface
- Connecting to the EV3 brick
- Downloading and running prebuilt programs
- Coordinating motor movement
- Calibrating the sensors
- Transferring data with data wires
- Adding logic with switch blocks
- Looping actions
- Troubleshooting problems with LEGO Mindstorms
- Broadcasting sounds and displaying images
- Updating LEGO Mindstorms
Skill Level Beginner
1. Getting Started
3. Explore a New Project
4. Connect with the EV3 Brick
5. Program Movement and Sensing
6. Adding Flow to a Program
7. Document Your Work
8. Troubleshoot Problems
9. Extra Tools
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.