introduction to my blocks - ev3 lessons · introduction to my blocks. lesson objectives learn how...
TRANSCRIPT
![Page 1: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/1.jpg)
BySanjayandArvindSeshan
INTERMEDIATEPROGRAMMINGLESSON
INTRODUCTIONTOMYBLOCKS
![Page 2: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/2.jpg)
LessonObjectivesLearnhowtomakecustomblocksintheEV3Software(MyBlocks)
LearnwhyaMyBlockisuseful
LearntoconstructaMyBlockwithInputsandOutputs(Parameters)
Note:ThenewfeaturesmentionedinthislessonareavailableinV.1.3ofbothHomeEditionandEducationEdition.Updateyoursoftwareifyouarenotrunningthisversion.
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 2
![Page 3: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/3.jpg)
WhatisaMyBlock?• AMyBlockisacombinationof
oneormoreblocksthatyoucreatethatcanbegroupedintoasingleblock
• MyBlocksarebasicallyyourowncustomblocks
• OnceaMyBlockiscreated,youcanuseitinmultipleprograms
• JustlikeanyotherblockinEV3,MyBlockscanhavebothinputsandoutputs(parameters)
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 3
ThetwoblocksaboveareexamplesofMyBlocks:• Move_Inches tellstherobotto
movethenumberofinchesweinput
• Turn_Degrees tellstherobottoturntheamountweinput
• TheseMyBlockswillbetaughtinseparatelessons.
CM
![Page 4: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/4.jpg)
WhendoYouUseaMyBlock?• Whenevertherobotisgoingtorepeatanactioninside
yourprogram
• Whencodeisrepeatedinadifferentprogram
• Organizeandsimplifyyourcode
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 4
![Page 5: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/5.jpg)
WhyShouldYouBother?BecauseofMyBlocks,yourmissionswilllooklikethis…
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 5
Insteadofthis….
Thismakesyourcodeeasiertoreadandeasiertomodify!!!
![Page 6: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/6.jpg)
WhatMakesaUsefulMyBlockNote:MakingMyBlockswithinputsandoutputscanmakethemfarmoreuseful.However,youneedtobecarefulnottomaketheMyBlocktoocomplicated.
Question:LookatthelistofthreeMyBlocksbelow.Whichonesdoyouthinkareusefulfortouse?◦ Move5CM(Movestherobotfivecentimeters)◦ MoveCM withacentimeterandpowerinput◦ MoveCM withcentimeter,power,angle,coast/brake,etc.inputs
Answer:◦ Move5CMmaybeusedoften,butyouwillbeforcedtomakeotherMyBlocksforotherdistances.Thiswillnotbefixablelater.
◦ MoveCM withcentimetersandpowerasinputsisprobablythebestchoice.◦ MoveCM withcentimeters,power,angle,coast/brake,etc.mightbemostcustomizable,butsomeoftheinputsmightneverbeused.
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 6
![Page 7: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/7.jpg)
Step1:HighlightBlocks
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 7
• Forthislesson,ourgoalistomoveadesiredamountofrotations atadesiredpowerandreturntheultrasonicvalue attheend
• Step1:SelectthetwoblocksinthecodethatyouwanttoturnintoaMyBlock
• Question:Whatwouldbetheinput(s)andoutput(s)forourMyBlock?
• Answer:Theinputsarepowerandrotations.TheOutputisdistancemeasuredbytheultrasonicsensor.
![Page 8: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/8.jpg)
Step2:LaunchMyBlockBuilder
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 8
• A:GotoToolsàMyBlockBuilder- Ifyouencounteranerror,viewthenextslide
• B:PickaMyBlockName
• C.AddaDescription
• D.SelectanIconforthewholeMyBlock
MoveRotationsandoutputUltrasonic
A
B C
D
![Page 9: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/9.jpg)
CommonErrorMessagesERROR1:
SOLUTION:YouneedtohighlighttheblocksbeforegoingintoMyBlockBuilder
ERROR2:
SOLUTION:Un-highlightthestartblockbeforegoingintoMyBlockBuilder
Ifyoucontinuetohavetroubleatthisstep,justselectasingleblockinyourprogramandcreateaMyBlockfromit.YoucaneditandaddmoreblockstoaMyBlockatanytime.Youcanevenchangetheinputsandoutputs* ofaMyBlockaftercreation.
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 9
*Newfor2017
![Page 10: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/10.jpg)
Step3:AddInputs/Outputs
A.Weneedtoaddtwoinputsandoneoutputsowewillclickthe+buttonthreetimes
B.Gobacktothefirstparameter
C.GotoParameterSetup
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 10
MoveRotationsandoutputUltrasonic
MoveRotationsandoutputUltrasonic
A
B
C
![Page 11: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/11.jpg)
Step4:SetupParameterforPower
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 11
B.SelectInputA.PickaName
D.Chooseadefaultvalue
MoveRotationsandoutputUltrasonic
Setmin&maxvalues(onlyavailablewithslider)
C.PowerisaNumber
E.ChoosebuttonStyle
ABCD
E
![Page 12: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/12.jpg)
Step5:SetupParameterforRotation
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 12
MoveRotationsandoutputUltrasonic
Nowclickonthesecondparameter
ABCD
E
B.SelectInputA.PickaName
D.ChooseadefaultvalueC.RotationisaNumber
E.ChoosebuttonStyle
![Page 13: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/13.jpg)
Step6:SetupParameterforUltrasonic
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 13
MoveRotationsandoutputUltrasonic
ABC
Nowclickonthethirdparameter
B.SelectOutput
A.PickaName
C.UltrasonicoutputisaNumber
![Page 14: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/14.jpg)
Step7:SetupParameterIcons
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 14
Inthisstep,wewillchangetheiconsfortheparametersfrom“a”toanimageofyourchoice.
A. Clickonaparameter
B.ClickonthetabParameterIconsifnotalreadyonthistab,andchooseanicon
C.RepeatstepsAandBforeachparameter
D.PressFinishwhenyouaredone.
A
B
C
![Page 15: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/15.jpg)
Step8:AddDataWiresA. WhenyouclickFinish(onprevious
slide)youwillseethis.
B. WireuptheMyBlockbydraggingadatawirefromeachparametertoitscorrespondingslotonthemovesteeringblockandsensorblock.
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 15
Thesegreyblocksareourinputs/outputs(parameters)thatweresetupautomaticallybytheMyBlockBuilder
![Page 16: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/16.jpg)
WhereistheMyBlock?A. YourMyBlockwillappearinthe
turquoisetab.Youcannowusethisblockinanyprogram.
B. Below,thesameMyBlockisusedtwice.Oncetomoveforward2rotationsandthenbackwards5rotations.
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 16
Note:ThesameMyBlockcanbeusedwithdifferentinput
values.
![Page 17: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/17.jpg)
EditingYourNewlyCreatedMyBlock
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 17
IfyouwanttochangeanythingintheMyBlockyoujustcreated,simplypressonthe“Edit”buttononthetopLeftcorneroftheMyBlock*
Youcanchangethename,addordeleteparameters,etc.
*Newfor2017
![Page 18: INTRODUCTION TO MY BLOCKS - EV3 Lessons · INTRODUCTION TO MY BLOCKS. Lesson Objectives Learn how to make custom blocks in the EV3 Software (My Blocks) Learn why a My Block is useful](https://reader035.vdocuments.us/reader035/viewer/2022062507/5fc31588ea7bae66605bd131/html5/thumbnails/18.jpg)
CreditsThistutorialwascreatedbySanjaySeshanandArvindSeshan
Morelessonsareavailableatwww.ev3lessons.com
©2015EV3LESSONS.COM(LASTEDIT9/25/2017) 18
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.