EV3 with Scratch

EV3 sumo fights with Scratch

This video shows very simple Scratch code to EV3 sumo fights. After starting the robot goes straight. When it leaves the white circle, it turns left. When something gets in its way, it speeds up.

We can change the robot's operation by changing turning left time and changing of the detection distance from the other robot.

Lego® EV3 with Scratch - How to smoothly control motor speed

I used the set Lego® Friends Olivia's Hamster Playground 41383 to show you how to control the EV3 motor speed in Scratch.

The motor speed can be set in Scratch by the "Motor A set power block". In this block we can enter the power in percent or substitude a variable.

In the first examle I'm setting the power with the arrow keys.

In the second example I'm controling it by another motor.


Lego® EV3 color sensor with Scratch

EV3 color sensor isn't fully supported in the current EV3 extension in Scratch. Only the brightness value is reported, that's why I call it a light sensor.

Light reflected from white gives more value than from another color. I used this property in the first example.

Second example is an alarm that wakes us up when the sun rises.

The third example is a classic one - line follower.

Lego® EV3 touch sensor with Scratch

Lego® EV3 touch sensor is supported by Scratch as a button. The button number is the port number to which the sensor is connected. We can use four sensors by connecting them into the different ports.

Below there are three examples of using touch sensor:

- the hat block "When 1 button pressed"
- "button 1 pressed" with "if"
- "button 1 pressed" with "wait until"

Programming Lego EV3 with Scratch

In order to use Lego Mindstorms EV3 with Scratch you must install and run Scratch Link, turn on bluetooth in your computer and in EV3 Brick and load EV3 extension in Scrach.

Using Lego EV3 with scratch is quite limited, but sufficient to do simple exercises. We can use touch sensor, ultrasonic sensor and motor position. In color sensor we can only use brightness. We can't move the motor by an angle. Only per seconds.

In this video I've tried to show how to install the required stuff and how to use to motor and sensors.