Lesson 2: Turn
Esta página necesita un navegador reciente (con soporte para SharedArrayBuffer). Por favor, actualiza Chrome, Edge, Firefox o Safari a la última versión.
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.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
The goal is 1000 mm to the robot's right. Turn right, then drive into the goal.
Haz clic en Ejecutar para ver la salida aquí.
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
Drive to the goal in the top-right corner: 1200 mm up, then 1200 mm to the right.
Haz clic en Ejecutar para ver la salida aquí.