외모#

펜#

pen.move#

pen.move(action) 메서드는 VR 펜의 위치를 ​​설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

action

VR 펜의 설정 위치는 UP 또는 DOWN 입니다.

반품: 없음.

  • UP - 펜은 놀이터에 선을 긋지 않습니다.

  • DOWN - 펜이 놀이터에 색깔 있는 선을 그릴 것입니다.

def main():
    # Position the VR Pen down.
    pen.move(DOWN)
    # Move forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_color#

pen.set_pen_color(color) 메서드는 VR 펜의 색상을 설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

color

VR 펜 색상: BLACK, RED, GREEN, 또는 BLUE.

반품: 없음.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the VR Pen color to blue.
    pen.set_pen_color(BLUE)
    # Drive forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_width#

pen.set_pen_width(width) 메서드는 VR 펜의 너비를 설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

width

VR 펜의 너비: EXTRA_THIN, THIN, MEDIUM, WIDE, 또는 EXTRA-WIDE.

반품: 없음.

기본 VR 펜 너비는 THIN 입니다.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the VR Pen's width to medium.
    pen.set_pen_width(MEDIUM)
    # Drive forward for 400 mm to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.set_pen_color_rgb#

pen.set_pen_color_rgb(red, green, blue, opacity) 메서드는 VR 펜의 색상에 대한 RGB 값을 설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

red

RGB 값에서 빨간색의 강도는 0에서 255까지의 범위를 갖습니다.

green

RGB 값에서 녹색의 강도는 0에서 255까지의 범위를 갖습니다.

blue

RGB 값에서 파란색의 강도는 0에서 255까지의 범위를 갖습니다.

opacity

VR 펜 색상의 투명도는 0%에서 100%까지 조절 가능합니다.

반품: 없음.

def main():
    # Move the VR Pen down.
    pen.move(DOWN)
    # Set the color to orange at full opacity.
    pen.set_pen_color_rgb(225, 112, 52, 100)
    # Drive forward for 400 MM to draw a line.
    drivetrain.drive_for(FORWARD, 400, MM)

pen.fill#

pen.fill(red, green, blue, opacity) 메서드는 VR 펜이 올려놓은 표면의 모양을 채워줍니다. 예를 들면 다음과 같습니다.

​VR 로봇은 작은 격자 무늬가 있는 표면 위에 놓여 있으며, 로봇 뒤쪽으로 파란색 격자선 하나가 보입니다.

​VR 플레이그라운드의 한쪽 구석으로, 모서리 격자 칸이 파란색으로 채워져 있고 그 옆 칸에 VR 로봇이 놓여 있습니다.

​파란색 바닥 위에 VR 로봇이 놓여 있습니다.

격자선

격자 사각형

격자가 없는 놀이터에서는 놀이터 바닥 전체를 채웁니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

red

RGB 값에서 빨간색의 강도는 0에서 255까지의 범위를 갖습니다.

green

RGB 값에서 녹색의 강도는 0에서 255까지의 범위를 갖습니다.

blue

RGB 값에서 파란색의 강도는 0에서 255까지의 범위를 갖습니다.

opacity

VR 펜 색상의 투명도는 0%에서 100%까지 조절 가능합니다.

반품: 없음.

def main():
    # Fill the playground's floor with blue at full opacity.
    pen.fill(43, 162, 202, 100)

인쇄#

brain.print#

brain.print(value, precision = 0) 메서드는 단어, 숫자 및 보고된 값을 출력 콘솔에 출력하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

value

값을 보고하는 모든 단어, 숫자 또는 센서. 단어는 반드시 따옴표로 묶어야 합니다: ”.

precision

Optional. The amount of decimals reported from a value from a sensor or variable, from precision = 0-precision = 9. The default print precision is 0.

반품: 없음.

def main():
    # Print the Drivetrain's current heading in degrees with 2 decimal points.
    brain.print("Drivetrain's heading:",
        drivetrain.heading(DEGREES), precision = 2)

brain.clear#

brain.clear() 메서드는 출력 콘솔의 모든 행을 지우고 커서를 첫 번째 줄로 재설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

반품: 없음.

def main():
    # Print "Project has started."
    brain.print("Project has started.")
    # Wait 3 seconds.
    wait(3, SECONDS)
    # Clear the print console.
    brain.clear()

brain.new_line#

brain.new_line() 메서드는 출력 콘솔에서 커서를 새 줄로 설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

반품: 없음.

def main():
    # Print "Project has started."
    brain.print("Project has started.")
    # Move the cursor to a new line.
    brain.new_line()

brain.set_print_color#

brain.set_print_color(color) 메서드는 인쇄 콘솔에 출력되는 텍스트의 색상을 설정하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

color

인쇄할 텍스트 색상: BLACK, BLACK, RED또는 GREEN기본값은 BLUE 입니다.

반품: 없음.

def main():
    # Set the print text color to red.
    brain.set_print_color(RED)
    # Print a message.
    brain.print("This is red!")

모니터 변수#

monitor_variable(“variable”, …) 메서드는 변수를 모니터 콘솔에 추가하여 변수 값을 확인하고 모니터링할 수 있도록 하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

variable

이전에 설정된 전역 변수.

반품: 없음.

# Create global variable.
disk_count = 1

def main():
    # Add disk_count to the Monitor Console.
    monitor_variable("disk_count")

모니터 센서#

monitor_sensor(“sensor”, …) 메서드는 센서 값을 모니터링할 수 있도록 센서를 모니터 콘솔에 추가하는 데 사용됩니다.

이는 대기 없는 메서드이므로 이후의 메서드들이 지연 없이 실행될 수 있습니다.

매개변수

설명

sensor

지원되는 모든 센서 식별자.

반품: 없음.

지원되는 센서 식별자:

  • brain.timer.time

  • drivetrain.is_done

  • drivetrain.is_moving

  • drivetrain.heading

  • drivetrain.rotation

  • drivetrain.velocity_rpm

  • drivetrain.velocity_percent

  • arm_motor.is_done

  • arm_motor.is_spinning

  • arm_motor.position_degrees

  • arm_motor.position_turns

  • arm_motor.velocity_rpm

  • arm_motor.velocity_percent

  • arm_motor_group.is_done

  • arm_motor_group.is_spinning

  • arm_motor_group.position_degrees

  • arm_motor_group.position_turns

  • arm_motor_group.velocity_rpm

  • arm_motor_group.velocity_percent

  • intake_motor.is_done

  • intake_motor.is_spinning

  • intake_motor.position_degrees

  • intake_motor.position_turns

  • intake_motor.velocity_rpm

  • intake_motor.velocity_percent

  • intake_motor_group.is_done

  • intake_motor_group.is_spinning

  • intake_motor_group.position_degrees

  • intake_motor_group.position_turns

  • intake_motor_group.velocity_rpm

  • intake_motor_group.velocity_percent

  • catapult_motor.is_done

  • catapult_motor.is_spinning

  • catapult_motor.position_degrees

  • catapult_motor.position_turns

  • catapult_motor.velocity_rpm

  • catapult_motor.velocity_percent

  • catapult_tension_motor.is_done

  • catapult_tension_motor.is_spinning

  • catapult_tension_motor.position_degrees

  • catapult_tension_motor.position_turns

  • catapult_tension_motor.velocity_rpm

  • catapult_tension_motor.velocity_percent

  • intake_bumper.pressing

  • bumper.pressing

  • front_distance.is_object_detected

  • front_distance.object_distance_mm

  • front_distance.object_distance_inches

  • front_optical.is_near_object

  • front_optical.color

  • front_optical.brightness

  • front_optical.hue

  • color.is_near_object

  • color.color

  • color.brightness

  • color.hue

def main():
    # Add the VR Robot's positional coordinates to the monitor console.
    monitor_sensor("location.position")