2018-05-31 00:42:17 +02:00
# Try
2018-02-27 00:16:17 +01:00
Get a quick introduction to programming with EV3.
2018-03-22 22:16:14 +01:00
![Display on EV3 Brick with Music Notes ](/static/getting-started/01_EyesOn_Intro.png )
2018-05-31 00:42:17 +02:00
We are excited to help you get started with @boardname @. In this project we will guide you through connecting your EV3 Brick, creating your first program, controlling a Large Motor, a Touch Sensor and a Color Sensor. These steps can take up to 45 minutes.
2018-02-27 00:16:17 +01:00
## Turn on your EV3 Brick
Power on your EV3 Brick by pressing the Center Button.
2018-03-22 22:16:14 +01:00
![Hand pressing power button ](/static/getting-started/02_PowerOn.png )
2018-02-27 00:16:17 +01:00
2018-03-22 22:16:14 +01:00
## Connect Your EV3 Brick to Your Device
2018-02-27 00:16:17 +01:00
Use the USB cable to connect your EV3 Brick to your device.
2018-03-24 00:26:46 +01:00
![Computer and cable connected to EV3 Brick ](/static/getting-started/03_insert-usb-02.png )
2018-03-22 22:16:14 +01:00
2018-02-27 00:16:17 +01:00
## Create and Run your First Program
2018-03-22 22:16:14 +01:00
**Code it:** Create the program shown here.
2018-02-27 00:16:17 +01:00
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
brick.showMood(moods.neutral)
music.playSoundEffect(sounds.communicationHello)
})
```
2018-03-22 22:16:14 +01:00
* Drag out a ``||brick:on button||`` block from Buttons section in the ``||brick:Brick||`` Toolbox drawer.
* Drag a Brick Screen ``||brick:show mood||`` block inside the ``||brick:on button||`` block.
* Change mood to ``neutral``.
2018-02-27 00:16:17 +01:00
```block
brick.showMood(moods.neutral)
```
2018-03-22 22:16:14 +01:00
* Drag a Music ``||music:play sound effect||`` block below the ``||brick:show mood||`` block.
* Change sound effect to ``communication hello``.
2018-02-27 00:16:17 +01:00
```block
music.playSoundEffect(sounds.communicationHello)
```
2018-03-22 22:16:14 +01:00
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
2018-02-27 00:16:17 +01:00
## Did It Work?
2018-03-22 22:16:14 +01:00
![EV3 Brick with eyes on the display ](/static/getting-started/05_EyesOn.png )
2018-02-27 00:16:17 +01:00
Verify that the program you just created shows eyes on the Brick Display, and that the EV3 Brick played the sound “Hello!”
**Well done!**
## Connect a Large Motor
Now you will learn to control the Large Motor.
2018-03-22 22:16:14 +01:00
![EV3 Brick with hands connecting Large Motor to Port D ](/static/getting-started/06_PlugInLargeMotor.png )
2018-03-21 20:36:49 +01:00
Connect a Large Motor to **Port D** of your EV3 Brick using any of the connector cables.
2018-02-27 00:16:17 +01:00
## Create and Run This Program
2018-03-22 22:16:14 +01:00
**Code it:** Create the program shown here.
2018-02-27 00:16:17 +01:00
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
2018-03-22 22:16:14 +01:00
* Start a new program.
* Drag a ``||motors:run large A motor||`` block inside the ``||brick:on button||`` block.
* Change ``large motor A`` to ``large motor D``.
* Click on the ** (+)** sign.
* Change to ``1`` rotation.
2018-02-27 00:16:17 +01:00
2018-03-22 22:16:14 +01:00
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
2018-02-27 00:16:17 +01:00
## Did It Rotate?
Confirm that your motor has turned one rotation at power level 50 before stopping.
2018-03-22 22:16:14 +01:00
![Large Motor D w/Rotating “WHRRR,” Hand, EV3 Brick ](/static/getting-started/08_WorkingLargeMotor.png )
2018-02-27 00:16:17 +01:00
Download and run the program as many times as you want in order to verify this, or tinker with different power levels and different rotations.
## Connect a Touch Sensor
We will now control the Large Motor using a Touch Sensor.
2018-03-22 22:16:14 +01:00
![Hands connecting Touch Sensor to Port 1 on EV3 Brick ](/static/getting-started/09_Connect_Touch.png )
2018-02-27 00:16:17 +01:00
Keeping the Large Motor connected to **Port D** , connect a Touch Sensor to **Port 1** of your EV3 Brick.
## Modify Your Program
2018-03-22 22:16:14 +01:00
**Code it:** Add code to the program for the Touch Sensor.
2018-02-27 00:16:17 +01:00
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
2018-03-22 22:16:14 +01:00
* Add a ``||sensors:pause until touch 1 pressed||`` Sensor block on top of the ``||motors:run large motor D||`` block.
2018-02-27 00:16:17 +01:00
```block
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
```
2018-03-22 22:16:14 +01:00
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
2018-02-27 00:16:17 +01:00
## Press the Touch Sensor
Confirm that the Large Motor has turned one rotation AFTER you press the Touch Sensor.
2018-03-22 22:16:14 +01:00
![Hand Touch Sensor Pressed & EV3 Brick & Large Motor ](/static/getting-started/11_TouchMotorWorking.png )
2018-02-27 00:16:17 +01:00
Download and run the program as many times as you want in order to verify this, or tinker with different Touch Sensor and Large Motor values.
## Connect a Color Sensor
Now we will try to control the Large Motor using another sensor.
2018-03-22 22:16:14 +01:00
![Hand connecting Color Sensor to Port 4, Large Motor D, EV3 Brick ](/static/getting-started/12_ConnectColor.png )
2018-02-27 00:16:17 +01:00
Keeping the Large Motor connected to **Port D** , connect the Color Sensor to **Port 4** .
2018-03-22 22:16:14 +01:00
**Code it:** Modify Your Program to use the Color Sensor.
2018-02-27 00:16:17 +01:00
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
2018-04-03 14:05:01 +02:00
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Green)
2018-02-27 00:16:17 +01:00
motors.largeD.run(50, 1, MoveUnit.Rotations)
})
```
2018-03-22 22:16:14 +01:00
* Using the same program, replace the ``||sensors:pause until touch 1||`` block with a ``||sensors:pause color sensor 3||`` for color block.
2018-02-27 00:16:17 +01:00
```block
2018-04-03 14:05:01 +02:00
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Green)
2018-02-27 00:16:17 +01:00
```
2018-03-22 22:16:14 +01:00
* Select the color you want to detect (e.g., green).
2018-02-27 00:16:17 +01:00
2018-03-22 22:16:14 +01:00
**Download:** Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
2018-02-27 00:16:17 +01:00
## Place a Colored Brick in Front of the Color Sensor
2018-03-22 22:16:14 +01:00
![IMG: Colored bricks in front of Color Sensor, hands, EV3 Brick ](/static/getting-started/14_ColorSensorWorking.png )
2018-02-27 00:16:17 +01:00
Confirm that the Large Motor has turned one rotation AFTER the Color Sensor has detected the colored brick.
Download and run the program as many times as you want in order to verify this, or tinker with different Color Sensor and Large Motor values.
2018-03-22 22:16:14 +01:00
Click on the **JavaScript** tab and change the color the Color Sensor detects to Black, Blue, Green, Yellow, Red, White, or Brown. Use Title Case for the color names.
2018-02-27 00:16:17 +01:00
## Well Done!
You have now learned how to control some of the inputs and outputs of the EV3.