You’ll find you often use the same sequence of blocks in different programs. Instead of creating the same sequence each time, you can turn it into a custom block with the help of the My Block Builder tool. Your custom block gets added to the palette and makes it easy to reuse code and share blocks with others.
- [Voiceover] Sometimes you'll notice that you use…the same sequence of blocks over and over again…in different programs.…While you could copy the sequence…from one program to another,…it's much easier to make it into a custom block…that you can use from the palette.…I've opened the 09_03 Custom Start project,…and what it tries to do is turn…the robot towards an IR beacon.…Inside the loop, the heading measurement…from the IR sensor is retrieved,…then it's multiplied by a factor from a constant…and that value is then used…as a power level input for move steering.…
This loop will stop when the heading is equal to zero,…or in other words, when the robot…is directly facing the beacon.…Once out of the loop, the robot moves towards the beacon.…This loop and the sequence inside is easily something…that can be used in multiple programs…where a robot searches for the IR beacon.…So this is a great example of something…I could make into a custom block.…First I highlight the code I want on my custom block.…Then I'll go to the Tools menu…
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.