Lesson 2: Turn
Halaman ini memerlukan browser terbaru (dengan dukungan SharedArrayBuffer). Silakan perbarui Chrome, Edge, Firefox, atau Safari ke versi terbaru.
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.
Kesulitan 1/5 · 100 koin + bonus kecil pada penyelesaian pertama hari ini
The goal is 1000 mm to the robot's right. Turn right, then drive into the goal.
Klik Jalankan untuk melihat output di sini.
Kesulitan 2/5 · 140 koin + bonus kecil pada penyelesaian pertama hari ini
Drive to the goal in the top-right corner: 1200 mm up, then 1200 mm to the right.
Klik Jalankan untuk melihat output di sini.