Crane mission (#907)
* dummy page * robot 1 lesson * added lesson 2 * added mission 2 * added link
This commit is contained in:
		@@ -24,6 +24,8 @@ If you found a bug, please try if it hasn't been fixed yet! Go to https://makeco
 | 
			
		||||
 | 
			
		||||
Go to https://makecode.mindstorms.com. The home screen is filled with videos, tutorials and examples that might be relevant for your missions.
 | 
			
		||||
 | 
			
		||||
On the home page, scroll down to the **FLL / City Shaper / Crane Mission** section for specific lessons related to Mission 2.
 | 
			
		||||
 | 
			
		||||
### Can I load both LEGO MINDSTORMS EV3 Software and MakeCode programs onto my EV3?
 | 
			
		||||
 | 
			
		||||
Yes.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								docs/tutorials/city-shaper/crane-mission.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								docs/tutorials/city-shaper/crane-mission.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
# Crane Mission Lessons
 | 
			
		||||
 | 
			
		||||
The [Crane Mission Lessons](https://firstinspiresst01.blob.core.windows.net/fll/2020/fll-ev3-overview.pdf) adapted for MakeCode.
 | 
			
		||||
 | 
			
		||||
## Lessons
 | 
			
		||||
 | 
			
		||||
```codecard
 | 
			
		||||
[
 | 
			
		||||
{
 | 
			
		||||
    "name": "Crane Mission / Robot 1",
 | 
			
		||||
    "description": "Learn the basics and build your first robot driving base.",
 | 
			
		||||
    "cardType": "tutorial",
 | 
			
		||||
    "url":"/tutorials/city-shaper/robot-1"
 | 
			
		||||
}, {
 | 
			
		||||
    "name": "Crane Mission / Robot 2",
 | 
			
		||||
    "description": "Program your robot to move in different ways.",
 | 
			
		||||
    "cardType": "tutorial",
 | 
			
		||||
    "url":"/tutorials/city-shaper/robot-2"
 | 
			
		||||
}
 | 
			
		||||
]
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## See Also
 | 
			
		||||
 | 
			
		||||
[Robot 1](/tutorials/city-shaper/robot-1),
 | 
			
		||||
[Robot 2](/tutorials/city-shaper/robot-2)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								docs/tutorials/city-shaper/mission-2.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								docs/tutorials/city-shaper/mission-2.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
# Mission 2 Lesson
 | 
			
		||||
 | 
			
		||||
Use the program below to tell your robot how to solve the Crane Mission (Mission 2).
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(0, 25, 2.25, MoveUnit.Rotations)
 | 
			
		||||
    control.timer1.reset()
 | 
			
		||||
    while (control.timer1.seconds() < 1.5) {
 | 
			
		||||
        motors.largeBC.steer(sensors.color1.light(LightIntensityMode.Reflected) - 40, 50)
 | 
			
		||||
    }
 | 
			
		||||
    motors.largeBC.stop()
 | 
			
		||||
    motors.largeBC.steer(0, 15, 0.25, MoveUnit.Rotations)
 | 
			
		||||
    motors.mediumA.run(25, 60, MoveUnit.Degrees)
 | 
			
		||||
    pause(2000)
 | 
			
		||||
    motors.mediumA.run(-25, 1, MoveUnit.Seconds)
 | 
			
		||||
    motors.largeBC.steer(0, -100, 4, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
motors.largeBC.setBrake(true)
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										41
									
								
								docs/tutorials/city-shaper/robot-1.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								docs/tutorials/city-shaper/robot-1.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
# Robot 1 Lesson
 | 
			
		||||
 | 
			
		||||
## Step 1 Build Your Driving Base Robot @unplugged
 | 
			
		||||
 | 
			
		||||
Build the robot driving base:
 | 
			
		||||
 | 
			
		||||
[](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
 | 
			
		||||
 | 
			
		||||
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Step 2 Show an image @fullscreen
 | 
			
		||||
 | 
			
		||||
It's useful to know that your program is running. Plug a ``||brick:show mood||`` from the **BRICK** toolbox
 | 
			
		||||
inside the ``||loops:on start||`` block. Change the image if you want!
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.showMood(moods.neutral)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 3 Try your code @fullscreen
 | 
			
		||||
 | 
			
		||||
Look at the simulator and check that your image is showing up. When you are ready, press the **DOWNLOAD** button
 | 
			
		||||
and follow the instructions to transfer your code on the brick.
 | 
			
		||||
 | 
			
		||||
## Step 4 Steer motors @fullscreen
 | 
			
		||||
 | 
			
		||||
Drag a ``||motors:steer motors||`` block from the **MOTORS** toolbox and snap it under ``||brick:show mood||``.
 | 
			
		||||
Click on the plus and make sure to tell your motors to turn **1** rotation.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.showMood(moods.neutral)
 | 
			
		||||
motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 5 Try your code @fullscreen
 | 
			
		||||
 | 
			
		||||
Whenever you make a code change, the simulator will restart and you can preview what your code will do there.
 | 
			
		||||
When you are ready, click **DOWNLOAD** and follow the instructions to transfer the code into your brick.
 | 
			
		||||
 | 
			
		||||
**Remember** Take the driving base apart at the end of the session, so the other group can build it next time
 | 
			
		||||
							
								
								
									
										94
									
								
								docs/tutorials/city-shaper/robot-2.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								docs/tutorials/city-shaper/robot-2.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
			
		||||
# Robot 2 Lesson
 | 
			
		||||
 | 
			
		||||
## Step 1 Build Your Driving Base Robot @unplugged
 | 
			
		||||
 | 
			
		||||
Build the robot driving base:
 | 
			
		||||
 | 
			
		||||
[](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
 | 
			
		||||
 | 
			
		||||
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Step 2 Show an image and move @fullscreen
 | 
			
		||||
 | 
			
		||||
Add the blocks to show an image and move the motors **B+C** for ``1`` rotation.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.showMood(moods.neutral)
 | 
			
		||||
motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 6 Brick button @fullscreen
 | 
			
		||||
 | 
			
		||||
Let's change the code so that your robot moves when the **UP** button is pressed.
 | 
			
		||||
Add a ``||brick:on button enter||`` block and move the ``||motors:steer motors||`` under it.
 | 
			
		||||
After downloading your code, press **UP** to move the robot.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
brick.showMood(moods.neutral)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 6 Braking @fullscreen
 | 
			
		||||
 | 
			
		||||
When the motors are done turning, the robot keeps on moving for a short distance. 
 | 
			
		||||
Turn on the **brakes**, so that your robot stops immediately.
 | 
			
		||||
Drag a ``||motors:set brake||`` block into the ``||loops:on start||`` and set it **ON** to the BC motors.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
brick.showMood(moods.neutral)
 | 
			
		||||
motors.largeBC.setBrake(true)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Step 8 Left and Right turn @fullscreen
 | 
			
		||||
 | 
			
		||||
Let's make the robot turn to the left when the **LEFT** button is pressed on the brick (and same for the right button).
 | 
			
		||||
Add a ``||steer motors||`` and change the turn ratio to go left.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(-50, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
brick.buttonRight.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(50, 50, 1, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 9 Backwards @fullscreen
 | 
			
		||||
 | 
			
		||||
Let's make the robot turn to the right when the **RIGHT** button is pressed on the brick.
 | 
			
		||||
Add a ``||steer motors||`` and change the speed to be negative. This will make the motor go backwards.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonDown.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(0, -50, 1, MoveUnit.Rotations)
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Step 10 Add a Ultrasonic sensor @fullscreen
 | 
			
		||||
 | 
			
		||||
Add a Ultrasonic sensor to your driving base.
 | 
			
		||||
 | 
			
		||||
[](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-ultrasonic-sensor-driving-base-61ffdfa461aee2470b8ddbeab16e2070.pdf)
 | 
			
		||||
 | 
			
		||||
If clicking the above images don't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
 | 
			
		||||
 | 
			
		||||
## Step 11 @fullscreen
 | 
			
		||||
 | 
			
		||||
Create a program that moves the Driving Base and makes it stop 6 cm from the Cuboid.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
 | 
			
		||||
    motors.largeBC.steer(0, 50)
 | 
			
		||||
    pauseUntil(() => sensors.ultrasonic4.distance() < 6)
 | 
			
		||||
    motors.largeBC.stop()
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Try sending your robot towards a wall!
 | 
			
		||||
		Reference in New Issue
	
	Block a user