Beginner Ev3 Programming Lesson 1

Transcription

BEGINNER EV3PROGRAMMINGLESSON 1Intro to Brick and Software,Moving Straight, TurningBy: Droids Roboticswww.ev3lessons.com

SECTION 1: EV3 BASICS Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

THE “BRICK” BUTTONS1 BackUndoStop ProgramShut Down EV32 Center ButtonSelect optionsRun Program3 L, R, Up, DownNavigate menus Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)133233

THE “BRICK” SCREENTabs on Screen12341. Run RecentFind programs you ranrecently2. File NavigationFind all programs by project3. Brick AppsPort views4. SettingsBluetooth, Wifi, Volume Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

PORTS, SENSORS, MOTORSPorts A, B, C, D MotorsDefault setup assumes RightMotor in C, Left Motor in BBDefaultsetupC Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)Ports 1, 2, 3, 4 Sensors

EV3 SOFTWAREOpen Saved ProjectOpen New Project Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

EV3 SOFTWARE: STARTING ANEW PROGRAMOpenedProjectsProject PropertiesList of programs Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)Create a ProjectOpened ProgramsCreate a Program

EV3 SOFTWARE:PROGRAMMING SCREENProgrammingArea orThe CommunicationPaneCanvasConnection statusDownload programs ready to be runDownload/play programs instantlyDownload a section of a program torunIntelligent EV3 Brick status: name andbattery level, etc.Port status and sensor readingsType of connection between the EV3Brick and the computer (BT, Wi-Fi, orUSB)Programming Blocks in6 Colored Tabs Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)Brick Status &Downloading

EV3 BLOCKS: COLORED TABSACTION BLOCKSMove, Large & MediumMotor, Display FLOW BLOCKSStart, Wait, Loop,Switch, Loop InterruptSENSOR BLOCKSBrick Buttons, Gyro,Color, UltrasonicDATA OPERATIONSVariables, Array, Logic,Math, Compare ADVANCED BLOCKSData Logging,Unregulated Motor MY BLOCKSCustom Blocks youcreate Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

SECTION 2: MOVING STRAIGHT Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

CHALLENGE: MOVE STRAIGHTSTEP 1: Green Block Tab, Clickand hold Move Steering anddrag to programming areaSTEP 2: Drop next to the StartBlock (green arrow) Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

MOVE STEERING BLOCKMove Steering BlockBMove Steering Controls and regulates two motors. Both motors move either forward (positivepower) or backward (negative power) Allows steering by applying more power toone of the two motorsCMode ofoperationSteeringControlfrom (-100100)Steering:Straightor turnwhere0 move straight;Positive# C more power than Bnegative# B more power than C Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)BrakeorBrake/CoastCoastPower (100to -100); positivePower/Speednumber is move forward;negative, moves backward.Note: small amount of powermay cause the robot to stall.Number of motorDuration/Distancedegrees, rotations orseconds

NEGATIVE & POSITIVE POWER:BACKWARD & FORWARDNegative Power BackwardsPositive Power Forward Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

CHALLENGE: MOVE STRAIGHT(3 SECONDS)STEP 1: Green Block Tab, Clickand hold Move Steering anddrag to programming areaA, B, C, D Output portsused for motors.STEP 2: Drop next to the StartBlock (green arrow)STEP 3: Select Options. Move “3Seconds”STEP 4: Connect USB cable toEV3 and Laptop.STEP 5: Download to EV3Large Motorrt is used to connect toDroids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)ou can downloadtheMedium Motor

MOVE STRAIGHT: SECONDS VS.DEGREES VS. ROTATIONSFINISHCHALLENGE: Move your robotforward from the start line to thefinish line (1) and back to the start (2).Try: Select SECONDS, DEGREES orROTATIONSSTART Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)2CWhat are some advantagesor disadvantages of usingeach one?Did you have to do a lot ofguess and check to reachthe line?1BTry: Different speeds

MOVE STRAIGHT CHALLENGE –PART 1 SUMMARYTEAMSSECONDS DEGREES ROTATIONSTeam 1Team 2Team 3Team 4 Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

MOVE STRAIGHT DISCUSSIONTeamsDid youguess andcheck alot?Didchangingthe speedmatter?Team 1Team 2Team 3Team 4 Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)What wasmoreaccurate?Seconds?Degrees?Do you thinkDo you thinkwheel size will battery levelmatter?matters?

MOVING STRAIGHT MOREACCURATELY: USE PORT VIEWTry “port view” on brick (on Brick Apps tab) Move your robot with your hand from your start line to your end line Read how many degrees your robot moved Use this number in the Move Steering Block to move the correctdistance. Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

SECTION 3: TURNING Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

PIVOT VS. SPIN TURNS180 Degree Pivot TurnBEnd PositionCMotorB MovesCStart PositionB180 Degree Spin TurnStart PositionBCEnd PositionCMotorsB and CMove Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)BNotice where the robotends in both picturesafter a 180 degree turn.In the Spin Turn, therobot moves a lot lessand that makes SpinTurns are great for tightpositions. Spin turns tendto be a bit faster but alsoa little less accurate.So when you need tomake turns on the FLLboard, you should decidewhich turn is best for you!

HOW TO MAKE PIVOT AND SPINTURNSSteering Value50-50BCPivot Turn Right100BCPivot Turn Left-100BCSpin Turn RightChange Steering value here Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)BCSpin Turn Left

MAKING A PIVOT TURN FOR 90DEGREESB?Program your robot to turn 90 degrees.Does therobot actually turn 90 degrees if you just pick 90degrees for distance? Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)BCC

HOW DO YOU MAKE THE ROBOTTURN 90 DEGREES?Ans. Try using the port view again tomeasure the turn and then input thecorrect number of degrees. Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

TURNING AN ATTACHMENTARM, NOT JUST THE WHEELS Attach a medium motor to Port Aor a large motor to Port D asneeded. Move Steering vs. Motor Block For moving your wheels youshould use a Move SteeringBlock that syncs both wheelmotors.For moving your attachment yourarm, you use either a MediumMotor Block or a Large MotorBlock because you don’t need tosync your motors. Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)Medium Motor BlockLarge Motor Block

le 1:MOTOR“ON” AND “WAIT”2: the robot detects a (black)ntilBLOCKSetecta black line, usingeand stoplockLeavinginsteadWAIT.the ofmotor“on” and “off”ouslyuseWAITfor of “degrees”?Whyuse thethe “on”insteadand if Maytwowantsecondsthe program to do other tasksend thewhileloopmovingusingTERRUPT and stop thee 2:“Wait” block in Flow Tabfor secondsdetect aWaitblackline, usingblock instead of WAIT.eously use the WAIT forck and if two secondsend the loop usingNTERRUPT and stop the Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)WAIT!

How to write a program to calibrate the light senSOMETHING FUN: DISPLAYBLOCK Use the Display Block todisplay information andpictures on the screen You can control the locationand size of text You can use this same blockto display sensor readingsand instructions. Challenge: Can you displayeyes on the screen whilemoving? Alternate eyeballsthat look left and right. Use the Display Block,Motor On and Wait Block Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

CHALLENGE SOLUTIONMotor OnDisplayBlockWaitBlock Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)MotorOff

CREDITS This tutorial was created by Sanjay Seshan and Arvind Seshan fromFLL Team Not the Droids You Are Looking For (Droids Robotics) We have additional material for more advanced lessons available onrequest. Useful tools for FLL teams and robot programmers are available atwww.ev3lessons.com The material is made available to you free of charge. However, wewould greatly appreciate a letter indicating that you are using thematerials and what you think of them. Feedback and suggestions are encouraged. Email: team@droidsrobotics.org Droids Robotics, 2014, v.1.1 (Last edit: 9/22/2014)

EV3 SOFTWARE: PROGRAMMING SCREEN Connection status Download programs ready to be run Download/play programs instantly Download a section of a program to run Intelligent EV3 Brick status: name and battery level, etc. Port status and sensor readings Type of connection between the EV3 Brick and the computer (BT, Wi-Fi, or USB)