LEGO MINDSTORMS Education EV3 시작하기 - 페이지 15
{카테고리_이름} LEGO MINDSTORMS Education EV3에 대한 시작하기을 온라인으로 검색하거나 PDF를 다운로드하세요. LEGO MINDSTORMS Education EV3 17 페이지. Micropython
LEGO MINDSTORMS Education EV3에 대해서도 마찬가지입니다: 다음 단계 (24 페이지), 매뉴얼 (26 페이지)
Getting Started with LEGO
Next, edit main.py so that it looks like this:
#!/usr/bin/env pybricks-micropython
from
pybricks.hubs
from
pybricks.ev3devices
from
pybricks.parameters
# Initialize the EV3 brick.
ev3 = EV3Brick()
# Initialize a motor at port B.
test_motor = Motor(Port.B)
# Play a sound.
ev3.speaker.beep()
# Run the motor up to 500 degrees per second. To a target angle of 90 degrees.
test_motor.run_target(500, 90)
# Play another beep sound.
ev3.speaker.beep(1000,
This program makes your robot beep, rotate the motor and beep again at a higher-pitched tone.
Run the program to make sure it works as you expected.
MINDSTORMS
®
Port B
Figure 2.7: The EV3 Brick with a Large Motor attached to Port B.
import
EV3Brick
import
Motor
import
Port
500)
LEGO, the LEGO logo and MINDSTORMS are trademarks of the LEGO Group.
©2019-2020 The LEGO Group.
Education EV3 MicroPython
®
Large Motor
Version 2.0.0
13