Shrink some of the tutorial sentences (#440)
* Shrink some of the tutorial sentences * Match the less than order for blocks * Include later tutorials in SUMMARY * Ditch 'using' in name
This commit is contained in:
parent
5277cc847c
commit
49ab5ec099
@ -14,6 +14,9 @@
|
||||
* [Run Motors](/tutorials/run-motors)
|
||||
* [Touch to Run](/tutorials/touch-to-run)
|
||||
* [Touch Sensor Values](/tutorials/touch-sensor-values)
|
||||
* [What Color?](/tutorials/what-color)
|
||||
* [Line Following](/tutorials/line-following)
|
||||
* [Green Light, Red Light](/tutorials/greenlight-redlight)
|
||||
|
||||
* [Coding](/coding)
|
||||
* [Autonomous Parking](/coding/autonomous-parking)
|
||||
|
@ -43,7 +43,7 @@ Step by step guides to coding your @boardname@.
|
||||
"url":"/tutorials/touch-to-run",
|
||||
"imageUrl":"/static/tutorials/touch-to-run.png"
|
||||
}, {
|
||||
"name": "Using Touch Sensor Values",
|
||||
"name": "Touch Sensor Values",
|
||||
"description": "Check the value of a Touch sensor and stop a motor if pressed.",
|
||||
"cardType": "tutorial",
|
||||
"url":"/tutorials/touch-sensor-values",
|
||||
|
@ -2,80 +2,78 @@
|
||||
|
||||
## Introduction @fullscreen
|
||||
|
||||
Make a program to follow a line using the Color sensor and reflected light.
|
||||
Make a program to follow a line using the Color sensor and reflected light. Let's test reflected light to see if it's white or black (on the line), and drive our robot accordingly.
|
||||
|
||||
![Brick with color sensors tracking a yellow line](/static/tutorials/line-following/line-following.gif)
|
||||
|
||||
## Step 1
|
||||
|
||||
We are going to test and see if the reflected light is white (outside the line) or black (on the line), and drive our robot accordingly. Open the ``||logic:Logic||`` Toolbox drawer. From the **Conditionals** section, drag out an ``||logic:If then else||`` block onto the Workspace, and drop it into the ``||loops:forever||`` loop.
|
||||
In the ``||logic:Logic||`` Toolbox drawer under the **Conditionals** section, drag out an ``||logic:If then else||`` block onto the Workspace, and drop it into the ``||loops:forever||`` loop.
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (true) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
forever(function () {
|
||||
if (true) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 2
|
||||
|
||||
Open the ``||logic:Logic||`` Toolbox drawer again. From the **Comparison** section, drag out ``||logic:0 < 0||`` comparison block onto the Workspace, and drop it into the ``||logic:if then else||`` block, replacing ``true``.
|
||||
Open the ``||logic:Logic||`` Toolbox drawer again. From the **Comparison** section, drag out ``||logic:0 < 0||`` comparison block and drop it into the ``||logic:if then else||`` block, replacing ``true``.
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (0 < 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
forever(function () {
|
||||
if (0 < 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 3
|
||||
|
||||
Open the ``||sensors:Sensors||`` Toolbox drawer. From the **Color Sensor** section, drag out a ``||sensors:color sensor light||`` value block onto the Workspace, and drop it into the first slot of the ``||logic:0 < 0||`` comparison block, replacing the `0`.
|
||||
Open the ``||sensors:Sensors||`` Toolbox drawer. From the **Color Sensor** section, drag out a ``||sensors:color sensor light||`` value block and drop it into the second slot of the ``||logic:0 < 0||`` comparison block, replacing the `0`.
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (sensors.color3.light(LightIntensityMode.Reflected) < 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
forever(function () {
|
||||
if (0 < sensors.color3.light(LightIntensityMode.Reflected)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 4
|
||||
|
||||
If the value of the reflected light is greater than 40% (white or very light) then our robot is outside the line, and we should steer it to the left. In the ``||logic:0 < 0||`` comparison block, click the operator drop-down menu to change from ``<`` to ``>`` comparison, and change the compared value to `40` replacing `0`.
|
||||
|
||||
![Logic operator dropdown for conditional block](/static/tutorials/line-following/if-then-else-dropdown.png)
|
||||
If the value of the reflected light is greater than 40% (white or very light), our robot is outside the line, so steer to the left. In the ``||logic:0 < 0||`` comparison block change the compared value to `40` replacing `0`.
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (sensors.color3.light(LightIntensityMode.Reflected) > 40) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
forever(function () {
|
||||
if (40 < sensors.color3.light(LightIntensityMode.Reflected)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 5
|
||||
|
||||
Open the ``||motors:Motors||`` Toolbox drawer. Drag out **2** ``||motors:tank large motors||`` blocks onto the Workspace, and drop one of them into the ``||logic:if||`` part, and the other into the ``||logic:else||`` part of the ``||logic:if then else||`` block.
|
||||
Open the ``||motors:Motors||`` Toolbox drawer. Drag out **2** ``||motors:tank large motors||`` blocks and drop one of them into the ``||logic:if||`` part, and the other into the ``||logic:else||`` part of the ``||logic:if then else||`` block.
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (sensors.color3.light(LightIntensityMode.Reflected) > 40) {
|
||||
motors.largeBC.tank(50, 50)
|
||||
} else {
|
||||
motors.largeBC.tank(50, 50)
|
||||
}
|
||||
})
|
||||
forever(function () {
|
||||
if (40 < sensors.color3.light(LightIntensityMode.Reflected)) {
|
||||
motors.largeBC.tank(50, 50)
|
||||
} else {
|
||||
motors.largeBC.tank(50, 50)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 6
|
||||
@ -83,13 +81,13 @@ forever(function () {
|
||||
In the first ``||motors:tank large motors||`` block in the ``||logic:if||`` clause, change the speed values of the motors from ``50%``, ``50%`` to ``5%``, ``15%``. This slows down the robot, and steers it to the left (because the **C** motor is driving faster than the **B** motor).
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (sensors.color3.light(LightIntensityMode.Reflected) > 40) {
|
||||
motors.largeBC.tank(5, 15)
|
||||
} else {
|
||||
motors.largeBC.tank(50, 50)
|
||||
}
|
||||
})
|
||||
forever(function () {
|
||||
if (40 < sensors.color3.light(LightIntensityMode.Reflected)) {
|
||||
motors.largeBC.tank(5, 15)
|
||||
} else {
|
||||
motors.largeBC.tank(50, 50)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
# Step 7
|
||||
@ -97,15 +95,17 @@ forever(function () {
|
||||
In the second ``||motors:tank large motors||`` block in the ``||logic:else||`` clause, change the speed values of the motors from ``50%``, ``50%`` to ``15%``, ``5%``. This slows down the robot, and steers it to the right (because the **B** motor is driving faster than the **C** motor).
|
||||
|
||||
```blocks
|
||||
forever(function () {
|
||||
if (sensors.color3.light(LightIntensityMode.Reflected) > 40) {
|
||||
motors.largeBC.tank(5, 15)
|
||||
} else {
|
||||
motors.largeBC.tank(15, 5)
|
||||
}
|
||||
})
|
||||
forever(function () {
|
||||
if (40 < sensors.color3.light(LightIntensityMode.Reflected)) {
|
||||
motors.largeBC.tank(5, 15)
|
||||
} else {
|
||||
motors.largeBC.tank(15, 5)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Step 8
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Attach a Color Sensor to Port 3 of your brick, and attach your brick to a driving base with large motors attached to Ports B and C. See the instructions for building a _Driving Base with Color Sensor Down_. Test your program by positioning your robot to the right of a dark, thick line and then let it drive!
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Attach a Color Sensor to Port 3 of your brick, and attach your brick to a driving base with large motors attached to Ports B and C. See the instructions for building a _Driving Base with Color Sensor Down_. Test your program by positioning your robot to the right of a dark, thick line and then let it drive!
|
||||
|
@ -58,4 +58,4 @@ brick.showString("Press my button!", 1)
|
||||
|
||||
## Step 6
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick.
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
@ -68,5 +68,7 @@ brick.showString("Press my buttons to make music!", 1)
|
||||
|
||||
## Step 6
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. You can add more ``||brick:on button||`` blocks to the Workspace and create other ``||music:play tone||`` melodies when different buttons are pressed to transform your brick into a musical instrument!
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
You can add more ``||brick:on button||`` blocks to the Workspace and create other ``||music:play tone||`` melodies when different buttons are pressed to transform your brick into a musical instrument!
|
||||
|
@ -49,9 +49,9 @@ brick.buttonDown.onEvent(ButtonEvent.Pressed, function () {
|
||||
|
||||
## Step 4
|
||||
|
||||
The ``||motors:run||`` blocks specify which type of motor to run (Large or Medium), and which port the motor is attached to (Ports A, B, C, or D). The default setting is to run the large motor attached to port A at 50% speed. When we press the Down button, we want our motor to run in the reverse direction.
|
||||
The ``||motors:run||`` blocks specify which type of motor to run (Large or Medium), and which port the motor is attached to (Ports A, B, C, or D). The default setting is to run the large motor attached to port A at 50% speed.
|
||||
|
||||
In the Run block that is in the On Button Down pressed block, change the speed value from ``50%`` to ``-50%``.
|
||||
When we press the Down button, we want our motor to run in the reverse direction. In the ``||motors:run||`` block that is in the ``||brick:on button down pressed||`` block, change the speed value from ``50%`` to ``-50%``.
|
||||
|
||||
![Motor speed select field](/static/tutorials/run-motors/run-speed-field.png)
|
||||
|
||||
@ -66,8 +66,8 @@ brick.buttonDown.onEvent(ButtonEvent.Pressed, function () {
|
||||
|
||||
## Step 5
|
||||
|
||||
Now, let’s add a Medium motor, and specify how many rotations we want the motor to run for.
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. Drag out **2** ``|brick:on button||`` blocks onto the Workspace. In the ``||brick:on button||`` blocks, use the drop-down menu to select the ``left`` and ``right`` buttons.
|
||||
Now, let’s add a Medium motor, and tell it how many rotations we want it to run for.
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. Drag out **2** ``|brick:on button||`` blocks. In the ``||brick:on button||`` blocks, use the drop-down menu to select the ``left`` and ``right`` buttons.
|
||||
|
||||
```blocks
|
||||
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
|
||||
@ -227,4 +227,6 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||
|
||||
## Step 13
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Attach a Large motor to Port A, and a Medium motor to Port D. Test your program by pressing the different buttons to see whether the correct motors are running as expected.
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Attach a Large motor to Port A, and a Medium motor to Port D. Test your program by pressing the different buttons to see whether the correct motors are running as expected.
|
||||
|
@ -89,4 +89,6 @@ forever(function () {
|
||||
|
||||
## Step 8
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Attach a Large motor to Port A, and a Touch sensor to Port 1 on your brick. Test your program by pressing the ENTER button. When the motor starts, press the touch sensor. Does the motor stop as expected?
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Attach a Large motor to Port A, and a Touch sensor to Port 1 on your brick. Test your program by pressing the ENTER button. When the motor starts, press the touch sensor. Does the motor stop as expected?
|
||||
|
@ -62,4 +62,6 @@ sensors.touch1.onEvent(ButtonEvent.Released, function () {
|
||||
|
||||
## Step 5
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Attach a Large motor to Port A, and a Touch sensor to Port 1 on your brick. Test your program by pressing and releasing the touch sensor – does the motor start and stop as expected?
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Attach a Large motor to Port A, and a Touch sensor to Port 1 on your brick. Test your program by pressing and releasing the touch sensor – does the motor start and stop as expected?
|
||||
|
@ -16,7 +16,7 @@ brick.showMood(moods.sleeping)
|
||||
|
||||
## Step 2
|
||||
|
||||
Notice your brick is snoring with eyes closed in the simulator! Let’s wake her up. Open the ``||brick:Brick||`` Toolbox drawer again. Drag out 2 more ``||brick:show mood||`` blocks onto the Workspace, and drop them into the ``||brick:on start||`` block also.
|
||||
Notice your brick is snoring with eyes closed in the simulator! Let’s wake her up. Open the ``||brick:Brick||`` Toolbox drawer again. Drag out **2** more ``||brick:show mood||`` blocks and drop them into the ``||brick:on start||`` block also.
|
||||
|
||||
```blocks
|
||||
brick.showMood(moods.sleeping)
|
||||
@ -50,5 +50,5 @@ brick.showMood(moods.love)
|
||||
|
||||
## Step 5
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick.
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
@ -48,7 +48,7 @@ brick.showString("Guess what animal?", 1)
|
||||
|
||||
## Step 5
|
||||
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. In the **Buttons** section, drag out **3** more ``||brick:on button||`` blocks onto the Workspace. Using the drop-down menu, select the ``right``, ``up``, and ``down`` buttons for these 3 blocks.
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. In the **Buttons** section, drag out **3** more ``||brick:on button||`` blocks. Using the drop-down menu, select the ``right``, ``up``, and ``down`` buttons for these 3 blocks.
|
||||
|
||||
```blocks
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
|
||||
@ -110,7 +110,7 @@ brick.showString("Guess what animal?", 0)
|
||||
|
||||
## Step 8
|
||||
|
||||
Open the ``||music:Music||`` Toolbox drawer. Drag out **4** ``||music:play sound effect||`` blocks onto the Workspace, and drop one of them into each of the ``||brick:on button||`` blocks, just after the ``||brick:show image||`` block.
|
||||
Open the ``||music:Music||`` Toolbox drawer. Drag out **4** ``||music:play sound effect||`` block and drop one of them into each of the ``||brick:on button||`` blocks, just after the ``||brick:show image||`` block.
|
||||
|
||||
```blocks
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
|
||||
@ -160,4 +160,6 @@ brick.showString("Guess what animal?", 0)
|
||||
|
||||
## Step 10
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Test your program with a friend by pressing the right, left, up, and down buttons on your brick. Have your friend guess what animal it is!
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Test your program with a friend by pressing the right, left, up, and down buttons on your brick. Have your friend guess what animal it is!
|
||||
|
@ -57,7 +57,7 @@ brick.showString("What color?", 1)
|
||||
|
||||
## Step 5
|
||||
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. From the **Buttons** section, drag out a **3** ``||brick:set status light||`` blocks onto the Workspace, and drop one of them each into the ``||sensors:on color detected||`` blocks.
|
||||
Open the ``||brick:Brick||`` Toolbox drawer. From the **Buttons** section, drag out a **3** ``||brick:set status light||`` blocks and drop one of them each into the ``||sensors:on color detected||`` blocks.
|
||||
|
||||
```blocks
|
||||
sensors.color3.onColorDetected(ColorSensorColor.Red, function () {
|
||||
@ -91,7 +91,7 @@ brick.showString("What color?", 1)
|
||||
|
||||
## Step 7
|
||||
|
||||
Open the ``||music:Music||`` Toolbox drawer. Drag out **3** ``||music:play sound effect||`` blocks onto the Workspace, and drop one of them each into the ``||sensors:on color detected||`` blocks after the ``||brick:set status light||`` block.
|
||||
Open the ``||music:Music||`` Toolbox drawer. Drag out **3** ``||music:play sound effect||`` blocks and drop one of them each into the ``||sensors:on color detected||`` blocks after the ``||brick:set status light||`` block.
|
||||
|
||||
```blocks
|
||||
sensors.color3.onColorDetected(ColorSensorColor.Red, function () {
|
||||
@ -131,4 +131,6 @@ brick.showString("What color?", 1)
|
||||
|
||||
## Step 9
|
||||
|
||||
Now, let’s download our program to the brick. Plug your @boardname@ into the computer with the USB cable, and click the blue **Download** button in the bottom left of your screen. Follow the directions to save your program to the brick. Attach a Color Sensor to Port 3 of your brick. Test your program by flashing Red, Green and Yellow colored paper or use LEGO bricks in front of the Color Sensor.
|
||||
Now, plug your @boardname@ into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
|
||||
|
||||
Attach a Color Sensor to Port 3 of your brick. Test your program by flashing Red, Green and Yellow colored paper or use LEGO bricks in front of the Color Sensor.
|
||||
|
Loading…
Reference in New Issue
Block a user