Open School Games

Coding and more






Talk to us on Facebook

Delicious Bookmark this on Delicious

Follow OpenSchoolGames on Twitter

Join the Blue Ribbon Online Free Speech Campaign Valid XHTML 1.0 Strict Valid CSS!

Think

Code

EV3

Hello World

Let's start with everyones favorite, Hello World but just to be clever let's make the greeting move across the display.

EV3 code blocks that display Hello World

That is a lot of code. Real EV3 code is like looking down a train track. It just goes on until it goes over the horizon. I moved these blocks around so we can see the entire program on one screen.

Let's take the blocks apart and talk about what each does.

EV3 start code block

This is the start button. We will use it to begin the execution of every program

EV3 variable code block

Our first block after start is a variable block. The variable block allows us to tell the program about a named place to store a value. I called this one number2. This is not a great name as it does not give me a clue as to how I am going to use it. In an earlier version of this program I must have had another variable called number1. When we get to writing bigger programs I will be more careful with my variable names. Another interesting thing about variable blocks is that they also tell our program the kind of information that will be held in the variable. In number2 we hold a number value.

EV3 beginning of a loop code block

Our only loop in this program begins here. We can think about it as a book mark that we will come back to when we reach the end of the loop

EV3 wait code block

This is a wait code block. There is only one thing we can do with a wait block. It causes our program to take a rest from execution. Programs never get tired but sometimes it can be nice to wait. In this case we are just making the display stop moving for one second. Wait buttons can also be made to wait for other events but we will wait for a more complicated program to talk about those.

References

  1. ^ Raspberry Pi Quick Start Guide
  2. ^ Code by Charlies Petzold
  3. ^ What is an LED?