EV3 Programming - Unified Robotics

Preview:

Citation preview

EV3 Programming

Software Used: Ev3 Education

Edition

Can be downloaded here:

https://education.lego.com/en-us/downloads/mindstorms-ev3/software

Creating a New File

Got to file in the upper left-hand corner, hover over new project, and select program. A new window named “Project” should pop up.

Programming Basics

• At the bottom of the screen are colored tabs that represent different categories of code blocks.

• By default, the program is open on the green tab of code blocks, which are the “Action” blocks.

Action

• In the middle of the green section are the 2 “Move” blocks: Move Steering and Move Tank, which both use motor ports B and C on the brick.

• Move Steering

• Move Tank

Move Steering

MoveTank

Large Motor

MediumMotor

Display Sound BrickStatusLight

Block Properties

Number of RotationsFrom motors (exclusiveTo On for Rotations)

Power (1-100)

Direction of Steering

Turning setting(On,On for SecondsOn for DegreesOn for Rotations)

Left Power

Right Power

Number of RotationsFrom motors (exclusiveTo On for Rotations)

Simple Program Example

• This program will make the robot go forward 10 rotations, turn for one rotation, and then go 10 more rotations.

Sensors

BrickButtons

ColorSensor

GyroSensor

MotorRotation

Timer TouchSensor

UltrasonicSensor

Useful to have when you need to trigger an event

Flow Control• This section contains

all the blocks for sequencing

• Loops are essential for making continuing programs

• Switches are used to allow two different outcomes. Can be determined directly by sensor input.

LoopWaitStart (inProgram bydefault)

Switch Loop Interrupt

Switch Options

Here are the many options of triggering the switch, most of which have to do with sensors.

Sample Switch and Loop Program

This program will move forward when

The ultrasonic sensor detects a distance less than 50 cm, and will stop otherwise.

Have Fun Programming!

Recommended