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
Year 10 Science 2012. Electricity is a type of energy. It can be transformed from many other types of energy; kinetic, chemical, nuclear etc.. We make use of electricity by transforming it . into. other types of energy; light, heat,...
What is a volcano? Volcanoes are formed when sticky rock called magma forces its way through a crack in the earth's crust.. The . magma or melted . rock that spills out of the crater. on the side of the...
The lived reality of dignity of risk in residential aged care: An empirical study. Catherine Joyce, Lyndal Bugeja, Justin Oakley, Carolina Weller, Sharon Licqurish, Laura Zark, Joseph Ibrahim.. Anglicare Australia National Conference. September 2019
Neurology 2000 Duloxetine (Cymbalta®) 60 or 120 mg./ day First FDA indication for DPN Placebo 30% pain reduction, drug 50% Side effects - nausea, somnolence, dizziness, dry mouth Pain. 2005 Jul;116:109-18 Pregabalin (Lyrica®) Binds Ca Channels, reduces NT release FDA...
Ethical Issues in Cost Allocation. An ethical issue arises when costs are allocated to products or services that are produced for both a competitive market and a public or governmental entity. The latter often purchases on a cost-plus basis creating...
Kaley Walker, University of Toronto, CA Atmospheric Chemistry Experiment Fourier Transform Spectrometer Is a solar occultation instrument on Canada's SCISAT-1 satellite => high S/N. Provides accurate measurements of a number of species throughout the stratosphere and mesosphere since February 2004.
Criminal justice is the set of laws that the state has decided it will prosecute. Criminal justice seeks to maintain the society as a whole. Its purpose is to. Deter and mitigate crime. Penalize and rehabilitate offenders. Civil justice deals...
Ready to download the document? Go ahead and hit continue!