Incremental update to 'try' and 'use' topics (#374)

This commit is contained in:
Galen Nickel 2018-03-21 12:36:49 -07:00 committed by Peli de Halleux
parent 918dc802e9
commit 336b7a5bf5
3 changed files with 35 additions and 57 deletions

View File

@ -20,9 +20,7 @@ Use the USB cable to connect your EV3 Brick to your device.
## Create and Run your First Program ## Create and Run your First Program
[IMG: Try Program Blocks (see JavaScript below)] 1) Create the program shown here:
1 - Create the program shown here:
```blocks ```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
@ -45,13 +43,7 @@ brick.showMood(moods.neutral)
music.playSoundEffect(sounds.communicationHello) music.playSoundEffect(sounds.communicationHello)
``` ```
2 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. 2) 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.
## ~ hint
Note: Click here for help and more information about the programming blocks.
## ~
## Did It Work? ## Did It Work?
@ -67,12 +59,10 @@ Verify that the program you just created shows eyes on the Brick Display, and th
Now you will learn to control the Large Motor. Now you will learn to control the Large Motor.
Connect a Large Motor to Port D of your EV3 Brick using any of the connector cables. Connect a Large Motor to **Port D** of your EV3 Brick using any of the connector cables.
## Create and Run This Program ## Create and Run This Program
[IMG: Program Blocks (see JavaScript below)]
1) Create the program shown here: 1) Create the program shown here:
```blocks ```blocks
@ -82,12 +72,12 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
``` ```
* Start a new program * Start a new program
* Drag a run large A motor block inside the on button block * Drag a ``||motors:run large A motor||`` block inside the ``||brick:on button||`` block
* Change large A to large D motors.largeD.run(50) * Change ``large motor A`` to ``large motor D``
* Click on the + sign * Click on the **(+)** sign
* Change to 1 rotation * Change to ``1`` rotation
2) 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. 2) 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.
## Did It Rotate? ## Did It Rotate?
@ -99,7 +89,7 @@ Download and run the program as many times as you want in order to verify this,
## Connect a Touch Sensor ## Connect a Touch Sensor
[IMG: Hands connecting Touch Sensor to Port 1 on EV3 Brick] [IMG: Hands connecting Touch Sensor to **Port 1** on EV3 Brick]
We will now control the Large Motor using a Touch Sensor. We will now control the Large Motor using a Touch Sensor.
@ -107,8 +97,6 @@ Keeping the Large Motor connected to **Port D**, connect a Touch Sensor to **Por
## Modify Your Program ## Modify Your Program
[IMG: Program Blocks (see JavaScript below)]
```blocks ```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.touch1.pauseUntil(ButtonEvent.Pressed) sensors.touch1.pauseUntil(ButtonEvent.Pressed)
@ -116,13 +104,13 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
}) })
``` ```
1) Add a pause until touch 1 pressed Sensor block on top of the run large D Motor block 1) Add a ``||sensors:pause until touch 1||`` pressed Sensor block on top of the ``||motors:run large motor D||`` block.
```block ```block
sensors.touch1.pauseUntil(ButtonEvent.Pressed) sensors.touch1.pauseUntil(ButtonEvent.Pressed)
``` ```
2) 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. 2) 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.
## Press the Touch Sensor ## Press the Touch Sensor
@ -141,8 +129,6 @@ Now we will try to control the Large Motor using another sensor.
Keeping the Large Motor connected to **Port D**, connect the Color Sensor to **Port 4**. Keeping the Large Motor connected to **Port D**, connect the Color Sensor to **Port 4**.
Modify Your Program Modify Your Program
[IMG: Program Blocks (see JavaScript below)]
```blocks ```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.color3.pauseForColor(ColorSensorColor.Green) sensors.color3.pauseForColor(ColorSensorColor.Green)
@ -150,7 +136,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
}) })
``` ```
1) Using the same program, replace the pause until touch 1 block with a pause color 3 for color block 1) Using the same program, replace the ``||sensors:pause until touch 1||`` block with a ``||sensors:pause color sensor 3||`` for color block
```block ```block
sensors.color3.pauseForColor(ColorSensorColor.Green) sensors.color3.pauseForColor(ColorSensorColor.Green)
@ -158,7 +144,7 @@ sensors.color3.pauseForColor(ColorSensorColor.Green)
2) Select the color you want to detect (e.g., green). 2) Select the color you want to detect (e.g., green).
3) 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. 3) 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.
## Place a Colored Brick in Front of the Color Sensor ## Place a Colored Brick in Front of the Color Sensor
@ -172,7 +158,5 @@ Click on the JavaScript tab and change the color the Color Sensor detects to Bla
## Well Done! ## Well Done!
[IMG: EV3 Driving Base]
You have now learned how to control some of the inputs and outputs of the EV3. You have now learned how to control some of the inputs and outputs of the EV3.

View File

@ -3,7 +3,7 @@
[IMG: EV3 Driving Base full w/cuboid] [IMG: EV3 Driving Base full w/cuboid]
Build a robot and drive into the world of robotics! Build a robot and drive into the world of robotics!
In this project we will guide you through building a Driving Base Robot and programming it to move straight and turn. You will also build and Object Detector Module, and program it to detect an object. Its a good idea to have done the [Try](/getting-started/try) sequence first. In this project we will guide you through building a Driving Base Robot and programming it to move straight and turn. You will also build and Object Detector Module, and program it to detect an object. Its a good idea to have done the [Try](/getting-started/try) sequence first.
## Connect ## Connect
@ -15,14 +15,12 @@ Would you use it to clean the school or plant trees?
## Build Your Driving Base Robot ## Build Your Driving Base Robot
[IMG: EV3 Driving Base Building Instructions Cover Image] Build the robot driving base:
* [Building instructions](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf) [![EV3 Driving Base](/static/lessons/common/ev3-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
## Make It Move ## Make It Move
[IMG: Program Blocks (see JavaScript below)]
1) Create a program that makes the Driving Base move forward and stop at the finish line, which is 1 meter away. 1) Create a program that makes the Driving Base move forward and stop at the finish line, which is 1 meter away.
Start by building this program: Start by building this program:
@ -33,22 +31,20 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
}) })
``` ```
* Drag a steer large B+C motor block inside the on button block * Drag a ``||motors:steer large B+C motor||`` block inside the ``||brick:on button||`` block
* Click on the + sign * Click on the **(+)** sign
* Change to 1 rotation * Change to ``1`` rotation
### ~ hint ### ~hint
Hint: You will have to modify the number of rotations until you find the number that matches the robot moving forward 1 meter and stopping. **Hint:** You will have to modify the number of rotations until you find the number that matches the robot moving forward 1 meter and stopping.
### ~ ### ~
2) 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. 2) 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.
## Make It Turn ## Make It Turn
[IMG: Program Blocks (see JavaScript below)]
```blocks ```blocks
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () { brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
motors.largeBC.steer(-50, 50, 1, MoveUnit.Rotations) motors.largeBC.steer(-50, 50, 1, MoveUnit.Rotations)
@ -57,14 +53,14 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
1) Create a new program that turns the Driving Base 180 degrees. 1) Create a new program that turns the Driving Base 180 degrees.
### ~ hint ### ~hint
Hint: You will have to modify the turn ratio and the number of rotations until the robot reaches 180 degrees. **Hint:** You will have to modify the turn ratio and the number of rotations until the robot reaches 180 degrees.
### ~ ### ~
2) 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. 2) 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.
## Add an Ultrasonic Sensor to Your Driving Base ## Add an Ultrasonic Sensor to Your Driving Base
@ -74,9 +70,7 @@ Hint: You will have to modify the turn ratio and the number of rotations until t
## Detect an Object ## Detect an Object
[IMG: Program Blocks (see JavaScript below)] 1) Create a program that moves the Driving Base and makes it stop ``6`` cm from the Cuboid.
1 - Create a program that moves the Driving Base and makes it stop ``6`` cm from the Cuboid.
Create a new program Create a new program
```blocks ```blocks
@ -88,26 +82,26 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
}) })
``` ```
* Drag a tank large B+C motor block inside the on button block * Drag a ``||motors:tank large B+C||`` motor block inside the on button block
* Drag a threshold Ultrasonic Sensor block and place below the motor block * Drag the Ultrasonic Sensor threshold ``||sensors:set ultrasonic 4||`` block and place it below the motor block
* Drag a stop all motors block and place it below the sensor block * Drag a ``|sensors:pause until ultrasonic 4||`` block and place it under the threshold block
* Drag a ``||motors:stop all motors||`` block and place it below the sensor block
### ~ hint ### ~hint
Hint: You will have to modify the values of the Ultrasonic Sensor block until the robot reaches the desired position. **Hint:** You will have to modify the values of the Ultrasonic Sensor block until the robot reaches the desired position.
### ~ ### ~
2) 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. 2) 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.
Click on the JavaScript tab and change and test the number value of the Ultrasonic Sensor Click on the **JavaScript** tab. Change and test the number value of the Ultrasonic
Sensor.
```typescript ```typescript
sensors.ultrasonic4.setThreshold(UltrasonicSensorEvent.ObjectDetected, 10) sensors.ultrasonic4.setThreshold(UltrasonicSensorEvent.ObjectDetected, 10)
``` ```
[IMG: EV3 Ultrasonic Sensor Driving Base Building Instructions Main Image]
**Congratulations!** **Congratulations!**
You are ready to move on to the next steps. You are ready to move on to the next steps.

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB