EV3 Getting Started Programming Blocks

Getting Started

Programs are written by creating a list of commands in the order that they should be executed (carried out). In EV3 Classroom, this list of commands is called a STACK.

EVENT BLOCKS are blocks that tell the brick WHEN to begin executing a stack of commands.

Event blocks are shaped and colored like this one:

The default for starting a program is to select it on the brick and press the middle button. If the pictured event block were to be used at the beginning of a STACK, the stack would run when the center button on the brick was pressed 

Commands are executed in ORDER, so how you order your commands is important. There are some CONTROL blocks that can change the order of a stack. Unless those CONTROL blocks are used, the robot will attempt to execute each command in the stack in the exact order that they are placed.

For example:

In this program, when the middle button on the EV3 brick is pressed, the robot will display the “eyes” graphic on the display screen and play the recorded sound “hello” 

It will display the eyes first and then play the sound afterward, but since the robot works so quickly, it will seem to happen at the same time.

Since there is no “end” set for the display, the eyes will remain on the screen. However, since the “play sound” says to do it until “done”, it will only do it until the recording is finished and then there will be no more sound.

MOTOR BLOCKS are used to control motors.

In this stack, when the center button is pressed, the motor that is attached to port D will rotate clockwise for 1 rotation 

With this block, the robot will only send a command to the motor attached to PORT D. If you want your motor to be attached to a different port, then you must change the letter indicated in the block from D to a different port.

There are several ways to tell the motor to turn. You can tell it to turn a number of rotations, a number of degrees (360 degrees in one full rotation) or for a number of seconds.

At times, you may want your robot to RESPOND to its environment. In that case, you will need to use EVENT blocks that involve SENSORS.

In this stack, the motor attached to PORT A will rotate clockwise for one rotation only when the color sensor senses the color green 

MOVEMENT BLOCKS – moving two motors together

If you want to move both motors at the same time, you will use a MOVEMENT BLOCK. Movement blocks will tell both motors to move together. The default PORTS for a movement block are PORT B for the motor on the left and PORT C for the motor on the right.