INTERMEDIATE PROGRAMMING LESSON My Blocks Overview Step-by-Step Visual Guide to Creating a My Block with Inputs with Outputs (Parameters) By: Droids Robotics LESSON OBJECTIVES 1. Learn how to make custom blocks in the EV3 Software (My Blocks) 2. Learn why a My Block is useful 3. Learn to construct a My Block with Inputs and Outputs (Parameters) 2015 EV3Lessons.com (Last Edit 11/01/2015) 2
WHAT IS A MY BLOCK? A My Block is a combination of one or more blocks that you create that can be grouped into a single block My Blocks are basically your own custom blocks Once a My Block is created, you can use it in multiple programs Just like any other block in EV3, My Blocks can have both inputs and outputs (parameters) 2015 EV3Lessons.com (Last Edit 11/01/2015) The two blocks above are examples of My Blocks: Move_Inches tells the robot to move the number of inches we
input Turn_Degrees tells the robot to turn the amount we input These My Blocks will be taught in separate lessons. 3 WHEN DO YOU USE A MY BLOCK Whenever the robot is going to repeat an action inside your program When code is repeated in a different program Organize and simplify your code Example: You have 2 different versions of a robot run in FLL and the first half of both of them are identical, then making the first half of the code into a My Block allows you to clean up your code in both programs. 2015 EV3Lessons.com (Last Edit 11/01/2015)
4 WHY SHOULD YOU BOTHER? Because of My Blocks, your missions will look like this Instead of this. This makes your code easier to read and easier to modify!!! 2015 EV3Lessons.com (Last Edit 11/01/2015) 5 DISCUSSION: WHAT MAKES A USEFUL MY BLOCK Note: Making My Blocks with inputs and outputs can make them far more useful. However, you need to be careful not to make the My Block too complicated. Question: Look at the list of three My Blocks below. Which ones do you think are useful for a team to use? Move5CM (Moves the robot five centimeters) MoveCM with a centimeter and power input
MoveCM with centimeter, power, angle, coast/brake, etc. inputs Answer: Move5CM may be used often, but you will be forced to make other My Blocks for other distances. This will not be fixable later. MoveCM with centimeters and power as inputs is probably the best choice. MoveCM with centimeters, power, angle, coast/brake, etc. might be most customizable, but some of the inputs might never be used. 2015 EV3Lessons.com (Last Edit 11/01/2015) 6 STEP 1: HIGHLIGHT BLOCKS For this lesson, our goal is to move a desired amount of rotations at a desired power and return the ultrasonic value at the end Question: What would be the input(s)
and output(s) for our My Block? Answer: The inputs are power and rotations. The Output is distance measured by the ultrasonic sensor. Step 1: Select the two blocks in the code that you want to turn into a My Block 2015 EV3Lessons.com (Last Edit 11/01/2015) 7 STEP 2: LAUNCH MY BLOCK BUILDER A A: Go to Tools My Block Builder - If you encounter an error, view the next slide B: Pick a My Block
Name C. Add a Description D. Select an Icon for the whole My Block B Move Rotations and output Ultrasonic C D 2015 EV3Lessons.com (Last Edit 11/01/2015) 8 COMMON ERROR MESSAGES IN THE MY BLOCK BUILDER ERROR 1: You must be on a diagram with a selection to create a My Block:
SOLUTION: You need to highlight all the blocks again before going into My Block Builder ERROR 2: Start Blocks are not allowed in the selection when creating My Blocks. Remove any Start Blocks from your selection and try making your My Block again. SOLUTION: Un-highlight the start block before going into My Block Builder If you continue to have trouble at this step, just select a single block in your program and create a My Block from it. You can edit add more blocks to a My Block at any time. However, you cannot change the inputs and outputs of a My Block after creation. If know of any other errors, please contact us: [email protected] and we will add them. 2015 EV3Lessons.com (Last Edit 11/01/2015) 9 STEP 3: ADD INPUTS/OUTPUTS (PARAMETERS) A A. We need to add two inputs
and one output so we will click the + button three times Move Rotations and output Ultrasonic B. Go back to the first parameter C. Go to Parameter Setup 2015 EV3Lessons.com (Last Edit 11/01/2015) B C Move Rotations and output Ultrasonic 10
STEP 4: SETUP PARAMETER FOR POWER Move Rotations and output Ultrasonic A. Pick a Name A B. Select Input B C D C. Power is a Number D. Choose a default value E
E. Choose button Style Set min & max values (only available with slider) 2015 EV3Lessons.com (Last Edit 11/01/2015) 11 STEP 5: SETUP PARAMETER FOR ROTATION Now click on the second parameter Move Rotations and output Ultrasonic A. Pick a Name A E
B C C. Rotation is a Number D. Choose a default value D B. Select Input E. Choose button Style 2015 EV3Lessons.com (Last Edit 11/01/2015) 12 STEP 6: SETUP PARAMETER FOR ULTRASONIC Now click on the third parameter Move Rotations and output Ultrasonic A. Pick a Name
A B. Select Output B C C. Ultrasonic output is a Number 2015 EV3Lessons.com (Last Edit 11/01/2015) 13 STEP 7: SETUP PARAMETER ICONS In this step, we will change the icons for the parameters from a to an image of your choice. A. Click on a parameter
B. Click on the tab Parameter Icons if not already on this tab, and choose an icon A B C. Repeat steps A and B for each parameter D. Press Finish when you are done. 2015 EV3Lessons.com (Last Edit 11/01/2015) C 14 STEP 8: ADD DATA WIRES A. When you click Finish (on These grey blocks are our inputs/outputs
(parameters) that were set up previous slide) you will see automatically by the My Block Builder this. B. Wire up the My Block by dragging a data wire from each parameter to its corresponding slot on the move steering block and sensor block. 2015 EV3Lessons.com (Last Edit 11/01/2015) 15 WHERE IS THE MY BLOCK? A. Your My Block will appear in the turquoise tab. You can now use this block in any program. B. Below, the same My Block is
used twice. Once to move forward 2 rotations and then backwards 5 rotations. 2015 EV3Lessons.com (Last Edit 11/01/2015) Note: The same My Block can be used with different input values. 16 CREDITS This tutorial was created by Sanjay Seshan and Arvind Seshan from Droids Robotics. More lessons are available at www.ev3lessons.com
Authors Email: [email protected] This work is licensed under a Creative Commons AttributionNonCommercial-ShareAlike 4.0 International License. 2015 EV3Lessons.com (Last Edit 11/01/2015) 17
To Kill a Mockingbird Background Notes (Nelle) Harper Lee, born in Monroeville, Alabama in 1926, has only this one novel to her credit, but it has been enough to earn her a Pulitzer Prize and a wide audience. ... Three...
Globalization and the Multinational Enterprise ... Cemex in Mexico is a resident in Level II, and Haier Group in China is an MNE resident in Level I Globalization and Creating Firm Value Murthy, CEO of Infosys, defines the globalization of...
Ask a participant to volunteer to read the definitions on page 12. Discuss the fact that "Risk" is the combination of likelihood of injury and the severity of injury (LxS = Risk) - and emphasize the importance of preventing injury.
Controls and Signals Maslab IAP 2010 ... we get discrete samples at a given sampling rate FIR Filters (Finite Impulse Response) IIR Filters (Infinite Impulse Response) Filter Types Low Pass -allows low frequencies to pass through High Pass - allows...
''Focus groups will tell you they hate negative ads and love positive ads,'' said Steve McMahon, a Democratic strategist. ''But call them back four days later and the only thing they can remember are the negative ones.'' And studies have...
* Boardworks A2 Biology Photosynthesis: The Reaction Teacher notes It could be highlighted that NADP is the electron acceptor in non-cyclic photophosphorylation, but not in cyclic photophosphorylation. * Boardworks A2 Biology Photosynthesis: The Reaction * Boardworks A2 Biology Respiration