Programare Roboti Lego 1

Program 1

from pybricks import ev3brick as brick

from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,                                 InfraredSensor, UltrasonicSensor, GyroSensor)

from pybricks.parameters import (Port, Stop, Direction, Button, Color,                                 SoundFile, ImageFile, Align)

from pybricks.tools import print, wait, StopWatch

from pybricks.robotics import DriveBase

brick.sound.beep()

dreapta=Motor(Port.A)

stanga=Motor(Port.B)

dreapta.run_target(200,300)

stanga.run_target(200,300)

Program 2

brick.sound.beep()

dreapta=Motor(Port.A)

stanga=Motor(Port.B)

robot=DriveBase(stanga,dreapta,43.2,114)

robot.drive_time(100,30,3000)