Lesson 2: Turn
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
English
Turning
drivetrain.turn_for(RIGHT, 90, DEGREES)turns the robot on the spot, 90 degrees to the right.- 90 degrees is a quarter turn. 180 degrees turns the robot round to face the other way.
- After a turn,
FORWARDdrives the way the robot now faces.
Words for this lesson
| Word | Meaning |
|---|---|
| turn | change the way the robot faces |
| degrees | how much it turns; a full turn is 360 degrees |
| LEFT / RIGHT | which way to turn |
| heading | the way the robot faces; 0 is up, 90 is right |
English
Drive, turn, drive
from vexcode_vr import *
def main():
drivetrain.drive_for(FORWARD, 500, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 500, MM)
vr_thread(main)
- The commands run one after the other, from top to bottom.
- The robot drives up, turns to face right, then drives right.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The goal is 1000 mm to the robot's right. Turn right, then drive into the goal.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Drive to the goal in the top-right corner: 1200 mm up, then 1200 mm to the right.
実行ボタンをクリックして出力を確認してください。