Lesson 1: Drive forward
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Meet the robot
- The robot drives on a playground: a square floor, 2000 mm on each side, with walls round the edge.
- You program it in Python, with the same commands as VEXcode VR (vr.vex.com). Code from here also works there.
- Press Run: the robot drives your program on the playground above the console.
Words for this lesson
| Word | Meaning |
|---|---|
| drivetrain | the wheels and motors that move the robot |
| FORWARD / REVERSE | drive to the front / drive backwards |
| mm | millimetres; 1000 mm = 1 metre |
| goal | the green square the robot must stop in |
English
Your first program
from vexcode_vr import *
def main():
drivetrain.drive_for(FORWARD, 400, MM)
vr_thread(main)
from vexcode_vr import *gives you the robot:drivetrain, its sensors and its pen.- Your commands go inside
main().vr_thread(main)starts it. VEXcode VR writes these lines for you, too. drivetrain.drive_for(FORWARD, 400, MM)drives 400 mm to the front, then stops.- Each square on the floor is 250 mm.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
The goal is 600 mm in front of the robot. Drive into the green goal square and stop there.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
This time the goal is behind the robot. Drive backwards 500 mm into the goal.
출력을 보려면 '실행'을 클릭하세요.