INTERMEDIATE PROGRAMMING Lesson

INTERMEDIATE PROGRAMMING Lesson

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

Recently Viewed Presentations

  • The French Revolution "Radical" Phase: 1792-1794 Attitudes &

    The French Revolution "Radical" Phase: 1792-1794 Attitudes &

    Jean-Paul Marat (1744 - 1793) ... "The Death of Marat"by Jacques Louis David, 1793. The Assassination of Maratby Charlotte Corday, 1793. The Assassination of Maratby Charlotte Corday (Paul Jacques . Aimee Baudry, 19c) The Levée en Masse:An Entire Nation at...
  • Chapter Two: Dr. Frankena

    Chapter Two: Dr. Frankena

    Times New Roman Arial Monotype Sorts fiestas Media Clip Microsoft ClipArt Gallery Chapter Two: Dr. Frankena What is Frankena's focus in his discussion of chapter two? Normative Ethics In our Mock Problems we have been practicing casuistry...
  • Autumn Term Class Newsletter Teacher: Mrs Hunt LSO:

    Autumn Term Class Newsletter Teacher: Mrs Hunt LSO:

    Our topic will be Dinosaur Planet. We will be exploring where dinosaurs lived, looking at fact books and videos to find out information, and making our own fossils. In Maths this term we will focus on place value and representing...
  • History of Scratchboard

    History of Scratchboard

    clay and ink. Easier and less time consuming than woodcut. No reverse image required. A . negative and a plate was made from that to print from. Scratchboard . originally . came . in . just black . and white,...
  • The Pursuit of Happiness (The Positive Psychology Movement)

    The Pursuit of Happiness (The Positive Psychology Movement)

    Arial MS Pゴシック Arial Black Times New Roman Candara Symbol Wingdings Fireworks Waveform 1_Fireworks 1_Waveform 2_Waveform 3_Waveform 4_Waveform 5_Waveform 6_Waveform Chart Before We Begin THE PURSUIT OF HAPPY-NESS Happiness is a human right. It's neither a luxury nor a triviality.
  • CCL  Referenti 8 Marzo 2006 1 Personale  A.

    CCL Referenti 8 Marzo 2006 1 Personale A.

    CCL - Referenti 8 Marzo 2006 Personale A. Bassi (Tempo parziale: 1/3) D. Bortolotti F. Brasolin P. Calligola (Tempo parziale ½) F. Martelli A. Monducci A. Paolucci G. Peco O. Pinazza F. Semeria ===== G. Artusi R. Giacomelli Personale (attivita')...
  • Linking Occupation, Health, and OT through Outcomes Research

    Linking Occupation, Health, and OT through Outcomes Research

    Linking Occupation, Health, and OT through Outcomes Research. Matthew Geddie, OTR, PhD. Rachel Kahlig, MOTS. INTRODUCTION. Lets get started. Thank you for joining me this afternoon, For those of you who don't know me, my name is Mariel Parra, I...
  • Kingdom Now Implications - 16 X 9

    Kingdom Now Implications - 16 X 9

    The Muslim Brotherhood's senior theoretician, SeyyidQutb, was transparent in the true agenda behind Islamic participation in interfaith dialogue, when he wrote, "The chasm between Islam and the Jahiliyyah [the society of unbelievers] is great, and a bridge is not to...