intermediate programming lessonintermediate programming lesson move distance my block (move_cm)...

13
By Sanjay and Arvind Seshan INTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM)

Upload: others

Post on 17-Mar-2021

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

BySanjayandArvindSeshan

INTERMEDIATEPROGRAMMINGLESSON

MOVEDISTANCEMYBLOCK(MOVE_CM)

Page 2: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

LessonObjectives1. CreateausefulMyBlock

2. LearnwhycreatingaMyBlockthattakesmeasurementsmadewitharulercanbeuseful

3. MakeaMove_CMMyBlock

Prerequisites:MovingStraight,PortView,MyBlockswithInputsandOutputs,MathBlocks,DataWires

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 2

Page 3: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

WhyaMoveDistanceMyBlock?Built-inmoveblockswillnottakeinputs(values)incentimetersorinches.

Itismucheasiertomeasuredistancewitharulerthandegreesorrotations.

Ifyouchangeyourrobotdesigntohavebiggerorsmallerwheelslateron,youdon’thavetore-measureeverymovementofyourrobot◦ Insteadofchangingdistancesineverysingleprogramyouwrote,justgointoyournewMoveDistanceBlockandchangethevalueforhowmanyinches/cmonemotor rotationwouldtake.

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 3

Page 4: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

MOVE_CMINTHREEEASYSTEPSSTEP1:Determinehowmanymotordegreesyourrobotmovesin1cm

STEP1A:WheelMeasurement

STEP1B:Programtherobottomove1cm

STEP2:AddaMathBlocktoconvertcentimeterstodegrees

STEP3:CreateaMove_CMMyBlockwith2inputs(poweranddegrees)

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 4

Page 5: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step1A:HowManyDegreesDoesTheRobotMovein1CM?

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 5

Method1:1. Lookupthewheelsizeinmmprintedonyourtireanddivideby10toconvertto

cm(because1cm=10mm)2. Multiplytheanswerinstep1byπ (3.1415…)tocomputecircumference3. Divide360degreesbyvaluefromstep2.Thiscomputesdegreesin1cmsinceyou

travelonecircumferencein1rotationand1rotationis360degrees

ExamplecalculationusingthestandardEV3Edu45544setwheels:

1. EV3EDU(45544)wheelsare56mm=5.6cmindiameter

2. 5.6cm× π =17.6cmperrotation3. 360degrees÷ 17.6cm=20.5motordegreespercm

Helpful chartwithcommonLEGOwheelsandtheir

diameters.

http://wheels.sariel.pl/

Page 6: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step1A:AlternativeMethod

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 6

AlternateMethod:UsePortViewtofindtheMotorDegreesvalue.Usethismethodifyoucannotfindthediametervalueprintedonyourwheel.

1. Putyourrulernexttoyourwheel/robot at0centimeters(whateverpartoftherobotyouusetoalignwith0,youshouldusetousetomeasuredistanceinstep2)

2. Rollyourrobotforwardanyamountofcentimeters,makingsureyourrobotdoesnotslip.

3. Takethedegreereadingyouseeonthescreenforthemotorsensoranddividebytheamountofcentimetersyoumoved.

4. Theanswerwillbethenumberofdegreesyourrobot'swheelsturn in1centimeter.

Page 7: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step1B:ProgramMove1CM

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 7

UsetheMotorDegreesvalueyouobtained foryourrobot inslides5or6

Page 8: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step2:DegreetoCMConversion

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 8

CreatetheCalculatorthatcovertsdegreestocentimeters

Page 9: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step3A:SetuptheMyBlock• A.HighlightthetwoblocksinStep2

andgotoMyBlockBuilder

• B.Addtwoinputs:PowerandCentimetersandcompletethesetupprocess.

• IfyouneedhelpintheMyBlockBuilder,refertotheMyBlockwithInputsandOutputsLessoninIntermediate

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 9

B

A

Page 10: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step3B:WiretheMyBLOCK

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 10

C.Wiretheinputs inthegreyblock.ThecentimetersinputconnectstotheMathBlock.ThepowergoesintotheMoveSteeringBlock’spowerinput.TheresultoftheMathBlockiswiredintothedegreesinput intheMoveSteeringBlock.

Page 11: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

Step3C:CompletedMove_CM

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 11

Page 12: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

DiscussionWhyisaMove_CMMyBlockuseful?◦ Youcanmeasuredistancesincentimetersandinput thisnumber intoyourblockinsteadofprogramming indegreesorrotations

WillchangingtheinputsinonecopyofMove_CM impactanothercopyofit?◦ No.ThatisexactlywhyaMyBlockisuseful.Youcanusethesameblockmultiple times,eachtimeusingadifferentnumber forpowerandcentimeters(oranyotherparameteryousetup).

CanyoualteraMyBlockafteritismade?◦ Youcanchangeanyofthecontents,butnotthegreyblocks(input andoutputparameters).Ifyouneedtomakechangestotheparameters,youmustremakeyourMyBlock.

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/2016 12

Page 13: INTERMEDIATE PROGRAMMING LESSONINTERMEDIATE PROGRAMMING LESSON MOVE DISTANCE MY BLOCK (MOVE_CM) Lesson Objectives 1. Create a useful My Block 2. Learn why creating a My Block that

CREDITSThistutorialwascreatedbySanjaySeshanandArvindSeshan

Morelessonsareavailableatwww.ev3lessons.com

COPYTIGHT©2015EV3LESSONS.COM,LASTEDIT7/06/201613

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.