(cid:53)(cid:46)(cid:47)(cid:38)(cid:38)(cid:41)(cid:35)(cid:41)(cid:33)(cid:44)(cid:0) GUIDES Chapter 1 Understanding Programming Concepts I f you’re reading this book you probably already know about some of the incredible things you can do with Lego Mindstorms You may have even built some Mindstorms robots yourself Hopefully you know how the different sensors are used how to create simple programs and how to use the EV3 programmable brick If not you should start by reading Unofficial Guides Mindstorms Level 1 and Level 2 Then come back to this book once you’re ready The EV3 software is extremely powerful It can be used to create robots far more complex than the ones we made in previous books This book will focus on creating programs that will allow your robots to do more than one thing at a time For example in the previous books we made a robot that could follow a line and a robot that would stop before running into walls But we can also write a program that tells a 4
MINDSTORMS Level 3 robot how to do both of those things In addition we will look at some icons in the EV3 software that you can use to accomplish some more complex things with your robot Let’s start by reviewing the basics of Mindstorms programming We will use the same robot we built for the activities in Level 1 and Level 2 The programming skills you learn from Mindstorms could help you learn a variety of other programming languages 5
(cid:53)(cid:46)(cid:47)(cid:38)(cid:38)(cid:41)(cid:35)(cid:41)(cid:33)(cid:44)(cid:0) GUIDES In the EV3 software drag the Move Tank icon into a new program Set it to simply turn the motors on For now this will be the only icon in your program Predict what you think will happen when you run it Now give it a try You might have predicted that the motors will run forever However either the robot will twitch slightly or nothing will happen at all To understand why this is you need to get familiar with some of the common EV3 icons The green arrow icon is the Start icon This is where every program will start If you put icons in the programming screen that are not attached to the Start icon nothing will happen 6
MINDSTORMS Level 3 If you want the robot to actually turn on and run forever then you should add a Forever loop to the end of the program You might think you should put the Move Tank icon inside the loop However it is more accurate to put the loop after the icon This way you are turning on the motors and then telling the program to run forever If the icon is inside the loop then you are actually telling it to keep turning on the motors Understanding these small differences is an important part of figuring out which order your icons should go in 7