-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (24 loc) · 828 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (24 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pybricks.ev3devices import Motor
from pybricks.parameters import Port
from pybricks.tools import wait
motor_esquerdo = Motor(Port.A)
motor_direito = Motor(Port.B)
# --- CURVA À DIREITA ---
motor_esquerdo.run(400)
motor_direito.run(0)
wait(1000) # Tempo suficiente para ele completar a curva para a direita
# --- AVANÇA EM LINHA RETA ---
motor_esquerdo.run(400)
motor_direito.run(400)
wait(2000) # Anda em linha reta por 2 segundos
# --- CURVA ACENTUADA À ESQUERDA (180°) ---
motor_esquerdo.run(0)
motor_direito.run(400)
wait(2000) # Tempo suficiente para ele completar a curva até ficar totalmente para a esquerda
# --- RETORNA EM LINHA RETA ---
motor_esquerdo.run(400)
motor_direito.run(400)
wait(2000) # Anda em linha reta por mais 2 segundos
# --- PARADA SEGURA ---
motor_esquerdo.stop()
motor_direito.stop()